Caused by: java.lang.IllegalAccessError: superclass access check failed: class butterknife.compiler.ButterKnifeProcessor$RScanner (in unnamed module @0x17051e76) 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 @0x17051e76
是ButterKnife和JDK17冲突了,编辑gradle.properties
在org.gradle.jvmargs=-Xmx4096m 加入以下几行
//(注\不能少)
org.gradle.jvmargs=-Xmx4096m \
--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
Some of the sun libraries needs to be made visible for the newer Java compilers. See this answer for more info. I added the following to our gradle.properties file and it fixed the problem. (We use Butterknife and Realm, and needed the below three packages added. (You might get away without "javac.code" for just Butterknife))
一些 sun 库需要对较新的 Java 编译器可见。请参阅此答案以获取更多信息。我将以下内容添加到我们的 gradle.properties 文件中,它解决了问题。 (我们使用 Butterknife 和 Realm,并且需要添加以下三个包。(对于 Butterknife,您可能不需要“javac.code”))