skip to Main Content

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


  1. 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.

    Login or Signup to reply.
  2. I resolved the issue by changes:

    1. change(or add) to android/settings.gradle:
      id "com.android.application" version "8.7.0" apply false
    2. add to android/gradle/wrapper/gradle-wrapper.properties: distributionUrl=https://services.gradle.org/distributions/gradle-8.10.2-all.zip
    3. install Android NDK (if not installed): idea settings
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search