1

This is a new, empty project with only the default code. I've attached screenshots of all relevant Gradle files and other version details.

When I add dependencies, such as shared_preferences and others, my project encounters errors. This code working fine in web but android getting error. Same error for path_provider lib as well

I've tried multiple versions but haven't been able to resolve the issue. Could you please help me find a solution?

Here is Error enter image description here

Settings.gradle enter image description here

gradle-wrapper.properties enter image description here

enter image description here

6
  • share_preference causing a lot prb recently. u may try "Hive" package Commented Nov 7, 2024 at 16:11
  • @JBJason Same error for path_provider as well so its related to some Gradle and sdk support issue Commented Nov 10, 2024 at 5:18
  • @JBJason Hive is a "No Choice", Hive is unsupported for two years now! Commented Nov 11, 2024 at 9:28
  • @Sanjayrajsinh Was this project an old one? Have you issue a flutter upgrade recently? Commented Nov 11, 2024 at 9:36
  • As I Mentioned this is new project with only demo code Commented Nov 11, 2024 at 12:34

2 Answers 2

1
+150

The error is somehow related to the new Android Studio update. Checkout this issue: https://github.com/flutter/flutter/issues/156304

This answer can fix your problem: https://stackoverflow.com/a/79095064/7369590

Sign up to request clarification or add additional context in comments.

2 Comments

Finally it's working. But I need to reinstall android studio and gradle then set gradle setting as per this answer.
@Sanjayrajsinh Unfortunately yes you should reinstall android studio. But this will solve almost every problem with the latest android studio update.
0

Did you tried running flutter doctor --android-licenses and accept all of them? that sometimes could cause issues if you didn't done that, also I found some other solutions to a similiar issue here: flutter error Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'

Also I'm not sure if you're on windows using WSL but looks like its one of the situations that could also cause your issue https://youtrack.jetbrains.com/issue/IDEA-291122/Cannot-query-the-value-of-this-provider-because-it-has-no-value-available-when-importing-the-Android-project

1 Comment

I already accept this but still facing same

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.