Execution failed for task ':flutter_plugin_android_lifecycle:compileDebugJavaWithJavac'.
Could not resolve all files for configuration ':flutter_plugin_android_lifecycle:androidJdkImage'. Failed to transform core-for-system-modules.jar to match attributes {artifactType=_internal_android_jdk_image, .gradle.libraryelements=jar, .gradle.usage=java-runtime}. after adding dependency
Execution failed for task ':flutter_plugin_android_lifecycle:compileDebugJavaWithJavac'.
Share Improve this question edited Mar 20 at 13:57 marc_s 756k184 gold badges1.4k silver badges1.5k bronze badges asked Mar 20 at 12:04 Vivek Vivek 11 bronze badge 1Could not resolve all files for configuration ':flutter_plugin_android_lifecycle:androidJdkImage'. Failed to transform core-for-system-modules.jar to match attributes {artifactType=_internal_android_jdk_image, .gradle.libraryelements=jar, .gradle.usage=java-runtime}. after adding dependency
- Please provide enough code so others can better understand or reproduce the problem. – Community Bot Commented Mar 24 at 1:10
1 Answer
Reset to default 1Need to do the below steps
Change in your app level
build.gradle
compileOptions { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } kotlinOptions { jvmTarget = "17" }
Change in
gradle
properties.gradle.java=C:\Program Files\Java\jdk-17
Set the JDK path by using the Android Studio Terminal
flutter config --jdk-dir="C:\\Program Files\\Java\\jdk-17"
NOTE - SET YOUR SYSTEM JDK PATH.
then run these commands-
flutter clean
flutter pub get
flutter run
If issue still exists, then restart your Android Studio (IDE) and run the above commands again. Hopefully the issue would be resolved.