FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ‘:sqflite_android:compileDebugJavaWithJavac’.
Could not resolve all files for configuration ‘:sqflite_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: C:Usershhh25AppDataLocalAndroidSdkplatformsandroid-34core-for-system-modules.jar.
> Error while executing process C:Program FilesAndroidAndroid Studiojbrbinjlink.exe with arguments {–module-path C:Usershhh25.gradlecachestransforms-34a46fc89ed5f9adfe3afebf74eb8bfebtransformedoutputtempjmod –add-modules java.base –output C:Usershhh25.gradlecachestransforms-34a46fc89ed5f9adfe3afebf74eb8bfebtransformedoutputjdkImage –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.
Get more help at https://help.gradle.org.
BUILD FAILED in 13s
Running Gradle task ‘assembleDebug’… 15.0s
Error: Gradle task assembleDebug failed with exit code 1
I have tried the following:
- Installing older versions, still doesn’t work
- deleting the sqflite dependency , it works
Here are the results of flutter doctor -v
[√] Flutter (Channel stable, 3.24.4, on Microsoft Windows [Version 10.0.19045.5011], locale en-US)
• Flutter version 3.24.4 on channel stable at C:fluterdevflutter_windows_3.24.3-stableflutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 603104015d (12 days ago), 2024-10-24 08:01:25 -0700
• Engine revision db49896cf2
• Dart version 3.5.4
• 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:Usershhh25AppDataLocalAndroidSdk
• Platform android-35, build-tools 35.0.0
• Java binary at: C:Program FilesAndroidAndroid Studiojbrbinjava
• 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 FilesGoogleChromeApplicationchrome.exe
[X] Visual Studio - develop Windows apps
X Visual Studio not installed; this is necessary to develop Windows apps.
Download at https://visualstudio.microsoft.com/downloads/.
Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 2024.2)
• Android Studio at C:Program FilesAndroidAndroid 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.95.1)
• VS Code at C:Usershhh25AppDataLocalProgramsMicrosoft VS Code
• Flutter extension version 3.100.0
[√] Connected device (4 available)
• SM M215G (mobile) • RZ8R80P4K2W • android-arm64 • Android 13 (API 33)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19045.5011]
• Chrome (web) • chrome • web-javascript • Google Chrome 130.0.6723.92
• Edge (web) • edge • web-javascript • Microsoft Edge 130.0.2849.68
[√] Network resources
• All expected network resources are available.
Here is my dependencies file
:
name: mabi3ati
description: "A new Flutter project."
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: ^3.5.3
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.8
sqflite: ^2.2.0
intl: ^0.19.0
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^4.0.0
flutter:
uses-material-design: true
2
Answers
I fixed it by
I'm still not sure why newer JDK didn't work though.
I found out the same happens using path_provider: https://github.com/flutter/flutter/issues/156558#issuecomment-2446956094
solution summary:
gradle-wrapper.properties
:settings.gradle
:Notes added here: https://github.com/tekartik/sqflite/blob/master/sqflite/doc/troubleshooting.md#could-not-resolve-all-files-for-configuration-sqflite_androidandroidjdkimage
(unfortunately there is not much I can to on my side to prevent this issue, maybe the flutter android template should be upgraded)