Reputation: 15
`Launching lib/flavors/main_dev.dart on sdk gphone arm64 in debug mode... Warning: 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.
Could not resolve all files for configuration ':google_sign_in_android: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/yurtaslanmac/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/yurtaslanmac/.gradle/caches/transforms-3/75ce9466628e968a28c2d9274c899d53/transformed/output/temp/jmod --add-modules java.base --output /Users/yurtaslanmac/.gradle/caches/transforms-3/75ce9466628e968a28c2d9274c899d53/transformed/output/jdkImage --disable-plugin system-modules}
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 10s Error: Gradle task assembleDevDebug failed with exit code 1
Exited (1). ` I encountered this problem after updating android studio. None of my apps build in android studio.
flutter doctor --verbose
`[✓] Flutter (Channel stable, 3.24.3, on macOS 15.0.1 24A348 darwin-arm64, locale en-TR) • Flutter version 3.24.3 on channel stable at /Users/yurtaslanmac/development/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 2663184aa7 (4 weeks ago), 2024-09-11 16:27:48 -0500 • Engine revision 36335019a8 • Dart version 3.5.3 • DevTools version 2.37.3
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /Users/yurtaslanmac/Library/Android/sdk • Platform android-34, build-tools 34.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11) • All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 16.0) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 16A242d • CocoaPods version 1.15.2
[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2024.2) • Android Studio at /Applications/Android Studio.app/Contents • 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+-79915917-b509.11)
[✓] VS Code (version 1.90.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.98.0
[✓] Connected device (4 available) • sdk gphone arm64 (mobile) • emulator-5554 • android-arm64 • Android 11 (API 30) (emulator) • macOS (desktop) • macos • darwin-arm64 • macOS 15.0.1 24A348 darwin-arm64 • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin • macOS 15.0.1 24A348 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 129.0.6668.90
[✓] Network resources • All expected network resources are available.
• No issues found!`
How can I fix this problem and build all my apps? Can you please help?
Upvotes: 1
Views: 340
Reputation: 31
You are using Java JDK version of 21. Try to use java 17 by editing the java jdk location in Android Studio. It will resolve issue.
Now if you set JAVA_HOME environment variable to java 17, but your Android Studio still showing java 21. Then follow this steps:
You should first need to verify the version of Java JDK, to ensure that the JAVA_HOME variable in environment variables is correctly set. For this, open windows powershell and run this command:
echo $env:JAVA_HOME
If it is correctly set, then do all these following changes with your project:
1. Go to Android/app/build.gradle: Inside of compileOptions should looks like this.
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
2. Go to Android/local.properties, add the following line to enforce use of java version 17:
java.home=C:/Program Files/Java/jdk-17
3. Go to Android/gradle.properties, add the following line:
kotlin.jvm.target=17
Upvotes: 0
Reputation: 21
I solved a similar problem with opening the project's android folder as a separate project in Android Studio (Android Studio top left panel -> Open -> android folder in your project -> Click OK), which then prompted me to use the built-in upgrade manager. With that, I upgraded to the latest version of Gradle, and my flutter app was working again.
Upvotes: 2
Reputation: 333
This error is common when the Flutter package is not compatible with Java.
/Users/yurtaslanmac/.gradle/caches/transforms-3/75ce9466628e968a28c2d9274c899d53/
/Users/yurtaslanmac/.gradle/caches/transforms-3/75ce9466628e968a28c2d9274c899d53/
you can go to this file path C:/Users/yurtaslanmac/.gradle/caches/transforms-3/
and search both id 75ce9466628e968a28c2d9274c899d53
and 75ce9466628e968a28c2d9274c899d53
Delete both file than again build.
Upvotes: 1