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

本文描述了在新版AndroidStudio中使用Butterknife时遇到的superclassaccesscheckfailed错误,原因在于版本不兼容。解决方案包括将Gradle和JDK版本调整为Java15,并更新gradle-wrapper.properties文件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

新版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

后面即可正常运行

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值