skip to Main Content

I’m a beginner in Flutter and I’m facing an issue while trying to build my app. Here is the error message I encountered:

Warning: SDK processing. This version only understands SDK XML versions up to 3 but an SDK XML file of version 4 was encountered. This can happen if you use versions of Android Studio and the command-line tools that were released at different times.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Could not resolve all files for configuration ':app: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: /home/user-name/Android/Sdk/platforms/android-34/core-for-system-modules.jar.
         > Error while executing process /opt/android-studio/jbr/bin/jlink with arguments {--module-path /home/user-name/.gradle/caches/transforms-3/9263d05e7a9236c2cfa2ca39c5a20e5a/transformed/output/temp/jmod --add-modules java.base --output /home/user-name/.gradle/caches/transforms-3/9263d05e7a9236c2cfa2ca39c5a20e5a/transformed/output/jdkImage --disable-plugin system-modules}

here my flutter doctor:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.24.3, on Ubuntu 24.04.1 LTS 6.8.0-45-generic,
    locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2024.2)
[✓] IntelliJ IDEA Ultimate Edition (version 2024.2)
[✓] Connected device (3 available)
[✓] Network resources


What I’ve tried so far:

  1. Set JAVA_HOME to Java 17 (/usr/lib/jvm/java-17-openjdk-amd64) and verified it with java -version.
  2. Change Android Studio Ladybug into koala ( same error appear ).
  3. Cleared the Gradle cache using ./gradlew clean and flutter clean, but the issue persists.
  4. Reinstalled Android SDK platform 34 using the Android Studio SDK Manager.

Despite these efforts, I keep running into this error when building the app. I’m not sure what else to try and would really appreciate any guidance or suggestions on how to fix this issue.

Additional Info:

Flutter version: 3.24
Java version: OpenJDK 17
Android Studio version: Android Studio Ladybug
OS: Ubuntu 24

error spsific solutions

2

Answers


  1. Try this (set your jdk path):

    flutter config --jdk-dir "/Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home"
    
    Login or Signup to reply.
  2. You can try the following steps to resolve the build issue:

    • Navigate to the android directory and run this command to update the Gradle version:

      ./gradlew wrapper --gradle-version latest

    • Update the android/settings.gradle by modifying it like this:

    id "com.android.application" version "8.7.0" apply false
    
    • Update the NDK version in android/app/build.gradle by adding or changing this line:
    ndkVersion = "27.0.12077973"
    

    Reference for details : answer

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search