butterknife icon indicating copy to clipboard operation
butterknife copied to clipboard

Gradle 8.0 build issue

Open alexmirash opened this issue 1 year ago • 55 comments

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

alexmirash avatar Apr 14 '23 10:04 alexmirash

i am also facing Same issue . Updated build version also

worksatfreelance avatar Apr 15 '23 09:04 worksatfreelance

I have same problem in my guess gradle 8.0 need jdk17 but butterknife is not surport jdk 17

koer1991 avatar Apr 17 '23 00:04 koer1991

I am also facing the same issue. Not even running the project. Please fix it.

rbalajicse avatar Apr 17 '23 11:04 rbalajicse

I am also facing the same issue with gradle 8.0. Can anyone please help me out ?

pahadi777 avatar Apr 18 '23 02:04 pahadi777

I am also facing issue with gradle 8.0 need jdk17

mitulbharatchandra avatar Apr 18 '23 07:04 mitulbharatchandra

same problem but gradle 8.0 isn't the reason, 7.2.2 - still appears appeared after update on Android Studio to Flamingo

jorrrdane avatar Apr 18 '23 09:04 jorrrdane

same problem but gradle 8.0 isn't the reason, 7.2.2 - still appears appeared after update on Android Studio to Flamingo

@jorrrdane I agree as well. It seems to be related to Flamingo upgrade. I just upgraded and run into this problem (Linux).

Android Studio Flamingo | 2022.2.1
Build #AI-222.4459.24.2221.9862592, built on March 31, 2023
Runtime version: 17.0.6+0-17.0.6b802.4-9586694 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 5.15.85-1-manjaro
GC: G1 Young Generation, G1 Old Generation
Memory: 3072M
Cores: 6
Registry:
    external.system.auto.import.disabled=true
    ide.text.editor.with.preview.show.floating.toolbar=false
    ide.instant.shutdown=false
    gradle.version.catalogs.dynamic.support=true

Non-Bundled Plugins:
    idea.plugin.protoeditor (222.4459.16)
    org.jetbrains.plugins.hocon (2022.1.0)
    com.github.adamwojszczyk.sepiaTheme (0.7.0)

Current Desktop: MATE

When I saw errors like this in the past, eventually they were related to the proguard. But in my case, I am building debug, so proguard should not even be in the picture

vladp avatar Apr 19 '23 04:04 vladp

I have upgraded a toy project to AGP 8.0 through a few walkarounds below

# <app/build.gradle>

# https://stackoverflow.com/questions/65380359/lomboks-access-to-jdk-compilers-internal-packages-incompatible-with-java-16

# enable internal JDK API access at runtime
tasks.withType(JavaCompile).configureEach {
    options.fork = true
    options.forkOptions.jvmArgs += [
        # essential for butterknife
        '--add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED',

        # if you need Glide or LomBok
        # these may not be the exact list, but it works for me
        '--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',
    ]
}
# <gradle.properties>

# https://developer.android.com/build/releases/gradle-plugin#default-changes

# @BindView requires a constant resource ID
android.nonFinalResIds=false

fish47 avatar Apr 19 '23 15:04 fish47

I am also facing this issue. please fix it as soon as possible @JakeWharton

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

keshavbhusal1 avatar Apr 23 '23 11:04 keshavbhusal1

go to Android Studio Preferences..., then Build, Execution, Deployment / Build Tools / Gradle, then set the Gradle JDK to be of some version 15

chenjia404 avatar Apr 25 '23 11:04 chenjia404

I have same problem in my guess gradle 8.0 need jdk17 but butterknife is not surport jdk 17

same issue . need solution.

dreamozilla avatar Apr 26 '23 05:04 dreamozilla

Apr 25, 2023

can't. when use gradle 8, JDK version 17 at least

dreamozilla avatar Apr 26 '23 05:04 dreamozilla

go to Android Studio Preferences..., then Build, Execution, Deployment / Build Tools / Gradle, then set the Gradle JDK to be of some version 15

Tested and effective

wujun2081 avatar Apr 27 '23 02:04 wujun2081

Faced the same issue. With this seetings it is working for me:

gradle-wrapper.properties: grafik

build.gradle (app): grafik

build.gradle (project) dependencies: grafik

JDK is 17.

mrfaa avatar May 10 '23 09:05 mrfaa

go to Android Studio Preferences..., then Build, Execution, Deployment / Build Tools / Gradle, then set the Gradle JDK to be of some version 15

Fix works if your gradle version is still under 8.0 (as it requires JDK 17 minimium).

savelyevdm avatar May 17 '23 13:05 savelyevdm

@JakeWharton If the library is discontinued in support - should we even hope for the update to support JDK 17 ?

savelyevdm avatar May 17 '23 13:05 savelyevdm

use JDK15 can fixed.

VectorWen avatar May 24 '23 08:05 VectorWen

its working thanks lot

ShaFaisal avatar May 24 '23 10:05 ShaFaisal

use JDK15 can fixed. this fix is not work

QODOHUB avatar Jun 08 '23 19:06 QODOHUB

The default JDK version of Android Studio Flamingo is 17 image, which will cause the compilation to fail.

Solution:

  1. Install OpenJDK 11 or JDK 11
  2. Modify the default JDK version of Android Studio

    Settings --> Gradle --> Gradle JDK:(set your install JDK)

eurigo avatar Jun 09 '23 03:06 eurigo

use JDK15 can fixed. this fix is not work are you sure?

payne1107 avatar Jun 10 '23 04:06 payne1107

Use Gradle JDK 11 version from settings search gradle and select JDK version 11, Works for me

nehal-gohil avatar Jul 24 '23 06:07 nehal-gohil

这是来自QQ邮箱的假期自动回复邮件。   您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。

payne1107 avatar Jul 24 '23 06:07 payne1107

Use JDK Version 11.0.19 actual version but use around 11 versions. it'll work.

dineshrajamanikam avatar Jul 25 '23 17:07 dineshrajamanikam

Hello! I used this on my build.gradle(app)

    kotlin {
        kotlinOptions {
            jvmTarget = "1.8"
        }
    }

Plus this:

["I faced this issue just after updating android Studio to Android Studio Flamingo | 2022.2.1, my project was using embeded jdk, i fixed using simple steps"](https://stackoverflow.com/questions/71257962/how-can-i-fix-this-error-with-butterknife-in-android-studio)

https://www.oracle.com/pk/java/technologies/javase/jdk11-archive-downloads.html
Download JDK 11 for your desired OS
Install it
Android Studio-> File -> Project Structure -> SDK Location -> Click on Gradle Settings (blue hightlighted text) -> Select the jdk 11 with 11.0 something version name from list
Run The Project
Boom! it's works

Or migrate to viewBinding

jdaccusys avatar Aug 28 '23 21:08 jdaccusys

这是来自QQ邮箱的假期自动回复邮件。   您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。

payne1107 avatar Aug 28 '23 21:08 payne1107

go to Android Studio Preferences..., then Build, Execution, Deployment / Build Tools / Gradle, then set the Gradle JDK to be of some version 15

Yes i did the same, i changed it to jdk 11 and now my project is working fine

Husnainfarooq avatar Sep 11 '23 07:09 Husnainfarooq

tasks.withType(JavaCompile).configureEach {

how to use the kotlin file, thanks

hzyxym avatar Oct 17 '23 12:10 hzyxym

这是来自QQ邮箱的假期自动回复邮件。   您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。

payne1107 avatar Oct 17 '23 12:10 payne1107

same problem, Please don't deprecate this lib. Although there is view binding, this lib are still better than view binding. eg.eliminating anonymous inner-classes for listeners by annotating methods with @OnClick and others.

softboy99 avatar Oct 18 '23 06:10 softboy99