Bootstrap

Android studio解决Execution failed for task ‘:app:compileDebugJavaWithJavac‘.报错

一,打包apk报错信息如下:

Execution failed for task ':app:compileDebugJavaWithJavac'.

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

二、解决办法:
1. 更新gradle到7.0.2;

2. 更新compileSdk到31,编译工具也到31版本;

3. 更新所有插件,androidx指定版本,如下:

implementation "androidx.core:core-ktx:1.7.0"

4. 更新Gradle java为15

5. 编译JAVA为1.8

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

重新clean打包,ok!

;