After installing shared_preferences, my app is not working.
Im getting this error:
`FAILURE: Build failed with an exception.
- 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:UserstobikAppDataLocalAndroidsdkplatformsandroid-34core-for-system-modules.jar.
Error: Gradle task assembleDebug failed with exit code 1
`
When i run flutter clean and flutter pub get without including the shared preferences everything is working.
I have tried updating android studio on Windows 11.
How do i make it work? Im using visual studio code.
2
Answers
I encountered this issue after upgrading to Android Studio Ladybug. To resolve it, I updated the Android Gradle Plugin (AGP) dependency from 8.1.0 to 8.7.2. Make sure to follow the pre-upgrade steps before changing the version and run the post-upgrade steps afterward.
I resolved the issue by changes:
id "com.android.application" version "8.7.0" apply false
distributionUrl=https://services.gradle.org/distributions/gradle-8.10.2-all.zip