skip to Main Content

When I updated Android Studio to Flamingo version, Gradle suggested the upgrade and I upgraded with AGP from 7.4 to 8.0. I was never able to debug after this upgrade, and as a result of my research, I could not come to a conclusion. If there is any information I have given missing for the problem, if you specify, I can make additions. I’m sharing my gradle module app codes because I think the problem stems from here.

My build.gradle(app):

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
    useLibrary 'org.apache.http.legacy'
    compileSdkVersion 33

    defaultConfig {
        applicationId "com.example.packagename"
        multiDexEnabled true
        minSdkVersion 22
        targetSdkVersion 33
        versionCode 15
        versionName "1.4"

    }
    buildTypes {
        release {
            minifyEnabled true

            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }
    kotlinOptions {
        jvmTarget = '11'
    }
    namespace 'com.example.packagename'

}

Error:

Execution failed for task ':app:compileDebugJavaWithJavac'.
> superclass access check failed: class butterknife.compiler.ButterKnifeProcessor$RScanner (in unnamed module @0x1db9193f) 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 @0x1db9193f
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:compileDebugJavaWithJavac'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:149)
.
.
.

I tried almost all the suggestions mentioned in StackOverFlow for solution but couldn’t reach a solution.

2

Answers


  1. Chosen as BEST ANSWER

    I solved the problem by reverting to the old version as follows. First of all, I downloaded and installed the Electric Eel version. (Official archive site to download old versions: CLICK)

    I then changed the content of gradle-wrapper.properties to:

    distributionBase=GRADLE_USER_HOME
    distributionUrl=https://services.gradle.org/distributions/gradle-8.0.1-bin.zip
    distributionPath=wrapper/dists
    zipStorePath=wrapper/dists
    zipStoreBase=GRADLE_USER_HOME
    

    Then I set the Gradle JDK with the steps "File > Build, Execution, Deploymend > Gradle" as follows: jbr-11 (Jetbrains Runtime version 11.0.5...)

    I then followed these steps: "File > Project Structure" And Android Gradle Plugin Version: 7.4.2 Gradle Version: 8.0.1

    Right now at least I'm able to compile and run my project. Thanks to everyone who tried to help.


  2. For now the only way how to get your project buildable is to make sure to use Java 11.

    1. In Android Studio go to Settings -> Build, Execution, Deployment -> Build Tools -> Gradle
    2. Gradle JDK – make sure you have selected Java 11
    3. In case it did not help, do not change the setting, rather try "Invalidate Caches…" with option to restart Android Studio and see if that helps.

    Also I would suggest to downgrade AGP back to 7.4. I know that this does not bring all the features and fixes on board, but as you said, there are few info out there about what we can do, now.
    On the other hand, author of Butterknife claims that he will manage "critical bug fixes for integration with AGP":
    enter image description here

    Also make sure that you have configure your build.gradle file to use Java 11:

    compileOptions {
        sourceCompatibility = "11"
        targetCompatibility = "11"
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search