0

I update android studio. I ran the project as usual.

In my project I use butterknife library.

When building the project, I got this error.

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

And while I was looking for a solution, butterknife issue, after updating to latest version of android studio with latest gradle plugin

found the article,

in the android section of the app-level build.gradle code

android
    {
     tasks.withType(JavaCompile).configureEach {
     options.fork = true
     options.forkOptions.jvmArgs += [
     '--add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED',
     '--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED',
     '--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED',
     '--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED',
     '--add-opens=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED',
     '--add-opens=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED',
     '--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED',
     '--add-opens=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED',
     '--add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED',
     '--add-opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED',
     ]
      
}

When I added the following, the project built normally like a lie.

However, I understand that this approach is a kind of hacky approach.

Is there a normal approach besides these approaches?

thank you

Boot Re
  • 21
  • 8
  • Butterknife is a deprecated library that has not received updates for years and now AGP 8 brings changes that literally break it. Recommended approach is to migrate to up to date solution aka jetpack ViewBinding. – Pawel Jul 19 '23 at 22:51
  • @Pawel Thank you i'll migrate to jetpack ViewBinding. – Boot Re Jul 23 '23 at 05:37
  • @BootRe Really it works for me and thanks a lot for solution. – MEGHA DOBARIYA Aug 01 '23 at 05:20

0 Answers0