error in gradle build in ladybug asking for agp compatibality
What went wrong:
Execution failed for task ‘:shared_preferences_android:compileDebugJavaWithJavac’.
Could not resolve all files for configuration ‘:shared_preferences_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:UsersscsAppDataLocalAndroidsdkplatformsandroid-34core-for-system-modules.jar.
> Error while executing process C:Program FilesAndroidAndroid Studiojbrbinjlink.exe with arguments {–module-path C:Usersscs.gradlecachestransforms-34a46fc89ed5f9adfe3afebf74eb8bfebtransformedoutputtempjmod –add-modules java.base –output C:Usersscs.gradlecachestransforms-34a46fc89ed5f9adfe3afebf74eb8bfebtransformedoutputjdkImage –disable-plugin system-modules}
2
Answers
Update: Gradle version:8.3 android/gradle/wrapper/gradle-wrapper.properties:
distributionUrl=https://services.gradle.org/distributions/gradle-8.3-all.zip
Update: Java version: 20
Notice: When you change project Gradle version and run application, then Java Compatibility version automatically download for this project. Don’t worry.
The error is somehow related to the new AndroidStudio update.Checkout this issue: https://github.com/flutter/flutter/issues/156304
To solve the problem checkout this answer: https://stackoverflow.com/a/79095064/7369590