[Error] Error reported after AS upgrade: Cause: superclass access check failed: class butterknife.compiler.ButterKnifeProces

After Android studio upgrade [Android Studio Giraffe | 2022.3.1]. Open the previous project and find an error.

Cause: superclass access check failed: class butterknife.compiler.ButterKnifeProcessor$RScanner (in unnamed module @0x4723fba2) 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 @0x4723fba2

insert image description here

Usually this kind of error we try

  • Clean Project;
  • Rebuild Project;
  • Invalidate Caches

However, it doesn't work after trying.

The reason is that after the Android Studio upgrade version, Gradle and plug-in versions are also 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.

When I open it it shows:
insert image description here

solution:

Settings–> Gradle–> Gradle JDK –> select the previously used version 8 or 11 or others -> APPLY–>OK;
insert image description here

The project can be re-edited by

おすすめ

転載: blog.csdn.net/mingtiannihao0522/article/details/132277929