Home > Mobile >  Hive import and pub get after flutter update gradle error
Hive import and pub get after flutter update gradle error

Time:01-09

Hello everyone sorry for misleading title did not know what to put there. The problem is while I import hive and hive_flutter or even add them to pub my project get the following error:

Execution failed for task ':path_provider_android:parseDebugLocalResources'.
> Could not resolve all files for configuration ':path_provider_android:androidApis'.
   > Failed to transform android.jar to match attributes {artifactType=android-platform-attr, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
      > Execution failed for PlatformAttrTransform: C:\Users\shahahmadian\AppData\Local\Android\Sdk\platforms\android-31\android.jar.
         > C:\Users\shahahmadian\AppData\Local\Android\Sdk\platforms\android-31\android.jar

which if I would like to be specific is because of:

Task :path_provider_android:compileDebugLibraryResources UP-TO-DATE
[        ] Caching disabled for task ':path_provider_android:compileDebugLibraryResources' because:
[        ]   Build cache is disabled
[    1 ms] Skipping task ':path_provider_android:compileDebugLibraryResources' as it is up-to-date.
[        ] :path_provider_android:compileDebugLibraryResources (Thread[included builds,5,main]) completed. Took 0.001 secs.
[        ] :path_provider_android:parseDebugLocalResources (Thread[included builds,5,main]) started.
[    1 ms] > Task :path_provider_android:parseDebugLocalResources FAILED
[        ] Transforming android.jar with PlatformAttrTransform
[    1 ms] Caching disabled for PlatformAttrTransform: C:\Users\shahahmadian\AppData\Local\Android\Sdk\platforms\android-31\android.jar because:
[    2 ms]   Build cache is disabled
[    1 ms] PlatformAttrTransform: C:\Users\shahahmadian\AppData\Local\Android\Sdk\platforms\android-31\android.jar is not up-to-date because:
[   49 ms]   Task has failed previously.

These logs are from flutter run -v and the message followed by this error log is:

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
[        ] You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
[        ] See https://docs.gradle.org/7.4/userguide/command_line_interface.html#sec:command_line_warnings
[        ] 24 actionable tasks: 5 executed, 19 up-to-date

now my flutter doctor is:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.3.10, on Microsoft Windows [Version 10.0.19045.2311], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.4.1)
[√] Android Studio (version 2021.3)
[√] VS Code (version 1.74.2)
[√] Connected device (4 available)
[√] HTTP Host Availability

• No issues found!

I have tried to change minsdk version and also target and compile sdk version as I assume the problem is because of gradle version and I'm going to downgrade my gradle version. I would be thankful for you guys to tell me what the problem is and alternatives for fixing this issue.

CodePudding user response:

It is seeking for android 31 sdk but did not find. Try installing sdk for android 31.

CodePudding user response:

thanks to @lakshydeep-vikram-sah when I checked sdk manager it said I have the latest 31 sdk and could not update to a newer version. the problem was that files of sdk 31 was missing so I copied android.jar file from sdk 33 and paste it in sdk 31 folder now every thing is running fine. enter image description here

  • Related