异常:
Cause: superclass access check failed: class butterknife.compiler.ButterKnifeProcessor$RScanner (in unnamed module @0x58402f7d) 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 @0x58402f7d
开发环境:
Android Studio Giraffe | 2022.3.1 Patch 3
Build #AI-223.8836.35.2231.11005911, built on October 26, 2023
Runtime version: 17.0.6+0-b2043.56-10027231 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0
Gradle Plugin 版本: classpath 'com.android.tools.build:gradle:8.1.3'
Gradle 版本:distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
解决方法:修改项目的gradle.properties文件
# The setting is particularly useful for tweaking memory settings. #org.gradle.jvmargs=-Xmx2048m org.gradle.jvmargs=-Xmx2048m \ --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \ --add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED \ --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
3 For ButterKnife compiler, also add
--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
Miha_x64 May 23, 2022 at 18:38