Cause: superclass access check failed: class butterknife.compiler error occurs when Android Studio uses butterknife

When using butterknife in the new version of Android studio, the following error occurs:

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

This is a version conflict issue

The solution is as follows: Open settings, find Gradle, and change the JDK version to java 15.

Then you need to modify the corresponding gradle version in build.gradle, otherwise new errors will appear.

plugins {
    id 'com.android.application' version '7.1.0' apply false
    id 'com.android.library' version '7.1.0' apply false
}

Then open gradle-wrapper.properties and replace the new gradle package. The following version is available for personal testing.

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

It will run normally later

Guess you like

Origin blog.csdn.net/Dragon_hopex/article/details/132609138