android / architecture-components-samples

Samples for Android Architecture Components.
https://d.android.com/arch
Apache License 2.0
23.4k stars 8.29k forks source link

BasicSample could not run bc java.lang.NoSuchMethodError: java.nio.file.Path.of(Ljava/lang/String;[Ljava/lang/String;)Ljava/nio/file/Path #1039

Open gongzelong0718 opened 2 years ago

gongzelong0718 commented 2 years ago

Issue with the samples?

➜  BasicSample git:(master) ./gradlew clean assemble

> Configure project :app
WARNING: DSL element 'android.dataBinding.enabled' is obsolete and has been replaced with 'android.buildFeatures.dataBinding'.
It will be removed in version 5.0 of the Android Gradle plugin.

> Task :app:compileDebugJavaWithJavac FAILED
warning: Current JDK version 1.8.0_172-b11 has a bug (https://bugs.openjdk.java.net/browse/JDK-8007720) that prevents Room from being incremental. Consider using JDK 11+ or the embedded JDK shipped with Android Studio 3.5+.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> java.lang.NoSuchMethodError: java.nio.file.Path.of(Ljava/lang/String;[Ljava/lang/String;)Ljava/nio/file/Path;

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 4s
46 actionable tasks: 43 executed, 3 up-to-date

Android Studio: 4.1.0 ➜ BasicSample git:(master) java -version java version "1.8.0_172"

rajkhowa commented 2 years ago

Facing same issue while running BasicSample

smileToWxm commented 2 years ago

It is found that the problem is room 2.4.0. If you restore the version to the previous 2.0.0, there will be no problem

phxism commented 2 years ago

downgrade versions.room = "2.4.0-alpha05" to versions.room = "2.3.0" fixed this problem~