The Android Studio upgrade causes the project to fail to run

Background: After upgrading the latest version of Android Studio, the new project runs normally, but when running the old project, it prompts a compilation error:

Execution failed for task ':EquipCore:compileDebugJavaWithJavac'.
> superclass access check failed: class butterknife.compiler.ButterKnifeProcessor$RScanner (in unnamed module @0x1b1ab21b) cannot access class com.sun.tools.javac.tree.TreeScanner (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.tree to unnamed module @0x1b1ab21b
Cause: superclass access check failed: class butterknife.compiler.ButterKnifeProcessor$RScanner 
(in unnamed module @0x1b1ab21b) cannot access class com.sun.tools.javac.tree.TreeScanner (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.tree to unnamed module @0x1b1ab21b

updated version
compile error one
Compile error two

Try the solution:
①: Build --> Clean Project; --> Rebuild Project;
②: build.gradle: modify gradle:version to the adapted version;
③: Settings–>Gradle–>Gradle JDK select the version used before;
④ : Settings–>Gradle–>Gradle JDK -->DownLoad JDK: version Select the previously used version (mine is 11), click DOWNLOAD–>Gradle JDK to select the download version–>APPLY–>OK; restart and run again;

Try the above solutions one by one, and finally solve the problem in solution ④.

Cause analysis: After Android Studio is upgraded, Gradle and plug-in versions are automatically upgraded. The Gradle version used in the previous project has been overwritten, and the corresponding jdk cannot be found in the configuration file, resulting in project compilation failure.

Guess you like

Origin blog.csdn.net/qq_28872655/article/details/130340928
Recommended