Android Studio使用butterknife出现Cause: superclass access check failed: class butterknife.compiler报错

新版Android studio使用butterknife出现报错如下

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

这是版本冲突的问题

解决方法如下:打开setting找到Gradle把JDK版本修改为java 15

接着在build.gradle也要修改对应的gradle版本,不然会出现新的报错

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

然后打开gradle-wrapper.properties替换新的gradle包,以下版本本人亲测可用

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

后面即可正常运行

猜你喜欢

转载自blog.csdn.net/Dragon_hopex/article/details/132609138