I made a flutter project using Android Studio but then due to some reason I had to shift on other platform Vs Code, when I tried running the build on Vs Code it started giving configuration error (assembleDebug).
the error was produced just by running the project or by creating a build, on doing
flutter run
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: C:\Users\asus\AppData\Local\Android\sdk\platforms\android-34\core-for-system-modules.jar. > Error while executing process D:\PkgsAll\Android Studio3\jbr\bin\jlink.exe with arguments {--module-path C:\Users\asus.gradle\caches\transforms-300円bbcb0a8e5e7db2e6b01a54c9879d3e\transformed\output\temp\jmod --add-modules java.base --output C:\Users\asus.gradle\caches\transforms-300円bbcb0a8e5e7db2e6b01a54c9879d3e\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. Get more help at https://help.gradle.org.
BUILD FAILED in 3m 16s Running Gradle task 'assembleDebug'... 200.1s Error: Gradle task assembleDebug failed with exit code 1
The desired behaviour should be like this
PS D:\AFlutter\prjs\flutterapp\flutterapp> flutter run
Launching lib\main.dart on sdk gphone64 x86 64 in debug mode... You are applying Flutter's app_plugin_loader Gradle plugin imperatively using the apply script method, which is deprecated and will be removed in a future release. Migrate to applying Gradle plugins with the declarative plugins block: https://flutter.dev/go/flutter-gradle-plugin-apply
You are applying Flutter's main Gradle plugin imperatively using the apply script method, which is deprecated and will be removed in a future release. Migrate to applying Gradle plugins with the declarative plugins block: https://flutter.dev/go/flutter-gradle-plugin-apply
Running Gradle task 'assembleDebug'... 77.6s √ Built build\app\outputs\flutter-apk\app-debug.apk Installing build\app\outputs\flutter-apk\app-debug.apk... 11.3s Syncing files to device sdk gphone64 x86 64... 379ms
Flutter run key commands. r Hot reload. R Hot restart. h List all available interactive commands. d Detach (terminate "flutter run" but leave application running). c Clear the screen q Quit (terminate the application on the device).
A Dart VM Service on sdk gphone64 x86 64 is available at: http://127.0.0.1:7780/EmwWHWK2iWQ=/ The Flutter DevTools debugger and profiler on sdk gphone64 x86 64 is available at: http://127.0.0.1:9101?uri=http://127.0.0.1:7780/EmwWHWK2iWQ=/ D/EGL_emulation(19692): app_time_stats: avg=612.76ms min=24.33ms max=1201.19ms count=2 D/EGL_emulation(19692): app_time_stats: avg=18335.46ms min=18335.46ms max=18335.46ms count=1
1 Answer 1
Well , I found the solution after debugging it was a issue of gradle properties. As project was first built on Android Studio so in gradle configuration gradle jdk was set of Android Studio. So we just need to change the gradle jdk path in file gradle.properties
change the gradle.properties from
to
add these 2 lines at the last
org.gradle.java.home=C:/Program Files/Eclipse Adoptium/jdk-17.0.17.10-hotspot
android.experimental.jdk.workspace.enabled=true
then
in terminal
flutter clean
flutter pub get
flutter run
Or
in android folder ./gradle assembleDebug --debug
Comments
Explore related questions
See similar questions with these tags.