Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Compile]: FAILED TO RUN AFTER UPDATING TO ANDROID STUDIO LADY BUG *** CRITICAL #3299

Closed
8 tasks done
mehrdad1990 opened this issue Oct 2, 2024 · 37 comments
Closed
8 tasks done
Labels
all android compile Compilation error

Comments

@mehrdad1990
Copy link

Operating System

Windows 11

Plugin

connectivity_plus

Version

6.0.5

Flutter SDK

Flutter 3.24.3 • channel stable • https://github.com/flutter/flutter.git Framework • revision 2663184aa7 (3 weeks ago) • 2024-09-11 16:27:48 -0500 Engine • revision 36335019a8 Tools • Dart 3.5.3 • DevTools 2.37.3

Compilation command

running the project normally in Android Studio:
flutter run
flutter debug

Dart Dependencies

No response

Native dependencies

No response

Compilation Error

* What went wrong:
Execution failed for task ':connectivity_plus:compileDebugJavaWithJavac'.
> Could not resolve all files for configuration ':connectivity_plus:androidJdkImage'.
   > Failed to transform core-for-system-modules.jar to match attributes {artifactType=_internal_android_jdk_image, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
      > Execution failed for JdkImageTransform: D:\SDK\platforms\android-34\core-for-system-modules.jar.
         > Error while executing process C:\Program Files\Android\Android Studio\jbr\bin\jlink.exe with arguments {--module-path C:\Users\ASUS\.gradle\caches\transforms-4\27d4116a6b8bfadbced0f80b87c44b18-3637e9fd-df62-40a9-93a2-142d7473c4e3\transformed\output\temp\jmod --add-modules java.base --output C:\Users\ASUS\.gradle\caches\transforms-4\27d4116a6b8bfadbced0f80b87c44b18-3637e9fd-df62-40a9-93a2-142d7473c4e3\transformed\output\jdkImage --disable-plugin system-modules}

Flutter Doctor

[√] Flutter (Channel stable, 3.24.3, on Microsoft Windows [Version 10.0.22631.4249], locale en-US)
    • Flutter version 3.24.3 on channel stable at D:\SDK\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 2663184aa7 (3 weeks ago), 2024-09-11 16:27:48 -0500
    • Engine revision 36335019a8
    • Dart version 3.5.3
    • DevTools version 2.37.3

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at D:\SDK
    • Platform android-35, build-tools 35.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 21.0.3+-12282718-b509.11)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.11.3)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.11.35303.130
    • Windows 10 SDK version 10.0.22621.0

[√] Android Studio (version 2024.2)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.3+-12282718-b509.11)

[√] Connected device (4 available)
    • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64    • Android 15 (API 35) (emulator)
    • Windows (desktop)            • windows       • windows-x64    • Microsoft Windows [Version 10.0.22631.4249]
    • Chrome (web)                 • chrome        • web-javascript • Google Chrome 129.0.6668.90
    • Edge (web)                   • edge          • web-javascript • Microsoft Edge 129.0.2792.65

[√] Network resources
    • All expected network resources are available.

• No issues found!
Process finished with exit code 0

Checklist before submitting a bug

  • I searched issues in this repository and couldn't find such bug/problem
  • I Google'd a solution and I couldn't find it
  • I searched on StackOverflow for a solution and I couldn't find it
  • I read the README.md file of the plugin
  • I'm using the latest version of the plugin
  • All dependencies are up to date with flutter pub upgrade
  • I did a flutter clean
  • I tried running the example project
@mehrdad1990 mehrdad1990 added compile Compilation error triage labels Oct 2, 2024
@AmrTawfek
Copy link

same issue

@mehrdad1990
Copy link
Author

same issue
@AmrTawfek
try this version in settings.gradle. Seems to sort out the issue for now:
id "com.android.application" version "8.3.2" apply false

@AmrTawfek
Copy link

AmrTawfek commented Oct 2, 2024

same issue
@AmrTawfek
try this version in settings.gradle. Seems to sort out the issue for now:
id "com.android.application" version "8.3.2" apply false

thanks @mehrdad1990 , I will try it because when I countered this issue I downgraded my IDE version to latest working one

@adham-ashraf77
Copy link

what is the Gradle version you use please in
distributionUrl?
@mehrdad1990

@daksh-gargas
Copy link

daksh-gargas commented Oct 3, 2024

Getting same issue on MacOS.

Downgrading the AndroidStudio did not fix the issue

* What went wrong:
Execution failed for task ':device_info_plus:compileReleaseJavaWithJavac'.
> Could not resolve all files for configuration ':device_info_plus:androidJdkImage'.
   > Failed to transform core-for-system-modules.jar to match attributes {artifactType=_internal_android_jdk_image, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
      > Execution failed for JdkImageTransform: /Users/daksh-gargas/dev/Android/sdk/platforms/android-34/core-for-system-modules.jar.
         > Error while executing process /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/jlink with arguments {--module-path /Users/daksh-gargas/.gradle/caches/transforms-3/e8dfe22a750ee0e24ac6b098f580808c/transformed/output/temp/jmod --add-modules java.base --output /Users/daksh-gargas/.gradle/caches/transforms-3/e8dfe22a750ee0e24ac6b098f580808c/transformed/output/jdkImage --disable-plugin system-modules}

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

@7AveNooN7
Copy link

7AveNooN7 commented Oct 3, 2024

* What went wrong:
Execution failed for task ':connectivity_plus:compileDebugJavaWithJavac'.
> Could not resolve all files for configuration ':connectivity_plus:androidJdkImage'.

Same problem, but I resolved it with updating AGP version (from 7.3.0):
id "com.android.application" version "8.3.0" apply false

Unfortunately updating to a newer AGP requires some additional tweaks.

@mehrdad1990
Copy link
Author

what is the Gradle version you use please in distributionUrl? @mehrdad1990

@adham-ashraf77
this is the version : gradle-8.6-all

@navin2580
Copy link

same for me. I am unable to use workaround with updating AGP version because it affects other packages :(

@Nico04
Copy link

Nico04 commented Oct 3, 2024

same for me. I am unable to use workaround with updating AGP version because it affects other packages :(

We have a huge app that use a lot of dependencies, I migrated AGP and all affected packages, I had to fork some myself unfortunately. But know it works.

@navin2580
Copy link

same for me. I am unable to use workaround with updating AGP version because it affects other packages :(

We have a huge app that use a lot of dependencies, I migrated AGP and all affected packages, I had to fork some myself unfortunately. But know it works.

Yep, that's the way, but I don't want to fork other packages if there's a chance of a possible fix

@iBog
Copy link

iBog commented Oct 3, 2024

seems working with latest

id "com.android.application" version "8.7.0" apply false

@TheHasnatBD
Copy link

the same issue, all tricks failed

@Supertommino
Copy link

This worked for me:

id "com.android.application" version "8.7.0" apply false

@mohmmadali155
Copy link

same issue

@ujwal-yadav-aot
Copy link

Could not resolve all files for configuration ':connectivity_plus:androidJdkImage'.

Failed to transform core-for-system-modules.jar to match attributes {artifactType=_internal_android_jdk_image, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
> Execution failed for JdkImageTransform: /Users/algooceansmacbook/Library/Android/sdk/platforms/android-34/core-for-system-modules.jar.
> Error while executing process /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/jlink with arguments {--module-path /Users/algooceansmacbook/.gradle/caches/transforms-3/b7ad379871a160c29269eed9ca2ef736/transformed/output/temp/jmod --add-modules java.base --output /Users/algooceansmacbook/.gradle/caches/transforms-3/b7ad379871a160c29269eed9ca2ef736/transformed/output/jdkImage --disable-plugin system-modules}

same issue

@malwinder-s
Copy link

malwinder-s commented Oct 4, 2024

Fixed issue by using:

id "com.android.application" version "8.7.0" apply false
in plugins block In android/settings.gradle

Also set in gradle-wrapper.properties:

distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
Currently using Java version:
java version "1.8.0_301"

@ujwal-yadav-aot
Copy link

Fixed issue by using:

id "com.android.application" version "8.7.0" apply false in plugins block In android/settings.gradle

yes this work for me additionally need to set distributionUrl=https://services.gradle.org/distributions/gradle-8.9-all.zip

@Kuhlemann
Copy link

Which Java/JDK-Version are you using in your projects for those solutions?

@miquelbeltran
Copy link
Member

Thanks to everyone for helping each other fix the compilation issue. I am marking this issue as completed, but I pinned it so it is easier to find.

Please do as said by malwinder-s:

Fixed issue by using:

id "com.android.application" version "8.7.0" apply false in plugins block In android/settings.gradle

Also set in gradle-wrapper.properties:

distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip

@Kuhlemann
Copy link

Please do as said by malwinder-s:

Fixed issue by using:
id "com.android.application" version "8.7.0" apply false in plugins block In android/settings.gradle
Also set in gradle-wrapper.properties:
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip

When doing so, I get the error:

Your project is configured with Android NDK 23.1.7779620, but the following plugin(s) depend on a different Android NDK version:

  • connectivity_plus requires Android NDK 27.0.12077973
  • ....

My android parameters inside my build.gradle look like this:

android {
    namespace "my_app"
    compileSdkVersion flutter.compileSdkVersion
    ndkVersion flutter.ndkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }

    kotlinOptions {
        jvmTarget = '17'
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    defaultConfig {
        applicationId "my_app"
        minSdkVersion 23
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    buildTypes {
        release {
            signingConfig signingConfigs.debug
        }
    }
}

I use Android Studio Ladybug 2024.2.1.
Before, with Koala and lower Gradle-version, everything worked fine.

@miquelbeltran
Copy link
Member

Do you need to specify the ndkVersion? We don't set that in any plugin project or any example project

@takeodev
Copy link

takeodev commented Oct 4, 2024

I had the same issue, in "gradle-wrapper.properties" raised the version to:
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip

and in the "app/build.gradle" put:
plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" id "com.android.application" version "8.3.2" apply false id "org.jetbrains.kotlin.android" version "1.8.22" apply false }

But now i have another problem, my Release APK doenst have icon anymore and crash on installing... anyone know what is it?
This is my "flutter doctor --verbose":
` [√] Flutter (Channel stable, 3.24.3, on Microsoft Windows [versÆo 10.0.22631.4169], locale pt-BR)
• Flutter version 3.24.3 on channel stable at c:\src\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 2663184aa7 (3 weeks ago), 2024-09-11 16:27:48 -0500
• Engine revision 36335019a8
• Dart version 3.5.3
• DevTools version 2.37.3

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
• Android SDK at C:\Users\Takeo\AppData\Local\Android\sdk
• Platform android-35, build-tools 35.0.0
• Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 21.0.3+-12282718-b509.11)
• All Android licenses accepted.

[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.7.4)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.7.34031.279
• Windows 10 SDK version 10.0.22621.0

[√] Android Studio (version 2024.2)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 21.0.3+-12282718-b509.11)

[√] VS Code (version 1.94.0)
• VS Code at C:\Users\Takeo\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.98.0

[√] Connected device (4 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 7.1.1 (API 25) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [versÆo 10.0.22631.4169]
• Chrome (web) • chrome • web-javascript • Google Chrome 127.0.6533.122
• Edge (web) • edge • web-javascript • Microsoft Edge 129.0.2792.65

[√] Network resources
• All expected network resources are available.

• No issues found!`

Dont have errors on building apk.

@Kuhlemann
Copy link

Do you need to specify the ndkVersion? We don't set that in any plugin project or any example project

flutter create -a creates this specification automatically, but I deleted the line now.

By doing so I got a step further, but my build stills fails:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':kiosk_mode:compileDebugKotlin'.
> Inconsistent JVM-target compatibility detected for tasks 'compileDebugJavaWithJavac' (1.8) and 'compileDebugKotlin' (21).

But this problem seems to be related to pub.dev package "kiosk_mode" not being compatible with newer JDK/Gradle-versions, if I understand the error correctly.

@miquelbeltran
Copy link
Member

Created a pinned issue with some more details on how to fix the recent Android compilation issues #3303

@arifxpartbd
Copy link

Same issue how to fix

  • What went wrong:
    Execution failed for task ':connectivity_plus:compileDebugJavaWithJavac'.

Could not resolve all files for configuration ':connectivity_plus:androidJdkImage'.
Failed to transform core-for-system-modules.jar to match attributes {artifactType=_internal_android_jdk_image, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
> Execution failed for JdkImageTransform: /Users/khanarif/Library/Android/sdk/platforms/android-34/core-for-system-modules.jar.
> Error while executing process /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/jlink with arguments {--module-path /Users/khanarif/.gradle/caches/8.10.2/transforms/032038f8b1fb7c8315d3916879a27cfe-f7a9d0f7-cfbc-4af5-bdad-53af67d8e3fe/transformed/output/temp/jmod --add-modules java.base --output /Users/khanarif/.gradle/caches/8.10.2/transforms/032038f8b1fb7c8315d3916879a27cfe-f7a9d0f7-cfbc-4af5-bdad-53af67d8e3fe/transformed/output/jdkImage --disable-plugin system-modules}

   pluginManagement {
def flutterSdkPath = {
    def properties = new Properties()
    file("local.properties").withInputStream { properties.load(it) }
    def flutterSdkPath = properties.getProperty("flutter.sdk")
    assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
    return flutterSdkPath
}
settings.ext.flutterSdkPath = flutterSdkPath()

includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")

plugins {
    id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false
}

}

include ":app"

apply from: "${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle/app_plugin_loader.gradle"

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-8.10.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

@ottomancoder
Copy link

Solution for Android Studio LadyBug Upgrade Issues

If you've encountered issues after upgrading to Android Studio LadyBug, here's how you can resolve them:

  1. Modify settings.gradle File:

    • Under the plugins section in your settings.gradle file, add the following line:
      id "com.android.application" version "8.3.2" apply false
  2. Gradle Plugin Error:

    • If you encounter any errors related to the Gradle plugin version, update your gradle-wrapper.properties file with the following:
      distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip

After making these changes, clean and rebuild your project to ensure everything compiles correctly.

@raad9114
Copy link

raad9114 commented Oct 7, 2024

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:checkDebugAarMetadata'.

A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
An issue was found when checking AAR metadata:

   1.  Dependency ':flutter_local_notifications' requires core library desugaring to be enabled
       for :app.

       See https://developer.android.com/studio/write/java8-support.html for more
       details.
  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
Get more help at https://help.gradle.org.

BUILD FAILED in 8s
Error: Gradle task assembleDebug failed with exit code 1

@adham-ashraf77
Copy link

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:checkDebugAarMetadata'.

A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
An issue was found when checking AAR metadata:

   1.  Dependency ':flutter_local_notifications' requires core library desugaring to be enabled
       for :app.

       See https://developer.android.com/studio/write/java8-support.html for more
       details.
  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
Get more help at https://help.gradle.org.

BUILD FAILED in 8s Error: Gradle task assembleDebug failed with exit code 1

Screenshot 2024-10-07 at 1 30 41 PM

add this found in docs

@chiragthummar
Copy link

If you dont want to go for this solution what I have applied is added specific JDK version using gradle.properties.
org.gradle.java.home=<Your java version path>.

I have set JDK 11 for my project which was running good on Android Studio Koala.

@wxkly8888
Copy link

It doesn't work for me for this workaround:
id "com.android.application" version "8.3.2" apply false

but finally I figured it out by this command:
flutter config --jdk-dir /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/home
change the argument to your own JDK path.

@NurhayatYurtaslan
Copy link

What should I do if the java version is 21. Should I update it to 17 and complete the other steps.

@flavioa44
Copy link

What should I do if the java version is 21. Should I update it to 17 and complete the other steps.

Had the same issue and this worked -> link

@hoanv810
Copy link

I have to downgrade Android Studio version to Koala 2024.1.2 Patch 1 and it works.

@winneze1
Copy link

Any news, fail in ios

@alextaymx
Copy link

It doesn't work for me for this workaround: id "com.android.application" version "8.3.2" apply false

but finally I figured it out by this command: flutter config --jdk-dir /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/home change the argument to your own JDK path.

This works for me

@Niko191292
Copy link

It doesn't work for me for this workaround: id "com.android.application" version "8.3.2" apply false

but finally I figured it out by this command: flutter config --jdk-dir /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/home change the argument to your own JDK path.

Dos not work for me in case I want to code native kotlin/java

@RbVs
Copy link

RbVs commented Oct 20, 2024

I had to downgrade Java to version 17 and change the version in settings.gradle from

id "com.android.application" version "7.3.0" apply false

to

id "com.android.application" version "8.7.0" apply false

Now it works without any issues. Important: Don’t forget to adjust the environment variable accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
all android compile Compilation error
Projects
None yet
Development

No branches or pull requests