plus_plugins icon indicating copy to clipboard operation
plus_plugins copied to clipboard

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

Open mehrdad1990 opened this issue 2 years ago • 47 comments

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

  • [X] I searched issues in this repository and couldn't find such bug/problem
  • [X] I Google'd a solution and I couldn't find it
  • [X] I searched on StackOverflow for a solution and I couldn't find it
  • [X] I read the README.md file of the plugin
  • [X] I'm using the latest version of the plugin
  • [X] All dependencies are up to date with flutter pub upgrade
  • [X] I did a flutter clean
  • [X] I tried running the example project

mehrdad1990 avatar Oct 02 '24 06:10 mehrdad1990

same issue

AmrTawfek avatar Oct 02 '24 07:10 AmrTawfek

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

mehrdad1990 avatar Oct 02 '24 08:10 mehrdad1990

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

AmrTawfek avatar Oct 02 '24 08:10 AmrTawfek

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

adham-ashraf77 avatar Oct 02 '24 18:10 adham-ashraf77

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.

daksh-wildr avatar Oct 03 '24 01:10 daksh-wildr

* 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.

ADeVNooN avatar Oct 03 '24 07:10 ADeVNooN

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

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

mehrdad1990 avatar Oct 03 '24 09:10 mehrdad1990

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

navin2580 avatar Oct 03 '24 14:10 navin2580

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.

Nico04 avatar Oct 03 '24 14:10 Nico04

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

navin2580 avatar Oct 03 '24 14:10 navin2580

seems working with latest

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

iBog avatar Oct 03 '24 14:10 iBog

the same issue, all tricks failed

TheHasnatBD avatar Oct 04 '24 02:10 TheHasnatBD

This worked for me:

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

Supertommino avatar Oct 04 '24 09:10 Supertommino

same issue

mohmmadali155 avatar Oct 04 '24 10:10 mohmmadali155

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

ujwal-yadav-aot avatar Oct 04 '24 10:10 ujwal-yadav-aot

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"

malwinder-s avatar Oct 04 '24 10:10 malwinder-s

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

ujwal-yadav-aot avatar Oct 04 '24 11:10 ujwal-yadav-aot

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

Kuhlemann avatar Oct 04 '24 12:10 Kuhlemann

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

miquelbeltran avatar Oct 04 '24 12:10 miquelbeltran

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.

Kuhlemann avatar Oct 04 '24 15:10 Kuhlemann