androidflutterdartgradledependencies

Flutter build failed after adding dependency, Error like "Could not determine the dependencies of task ':compileReleaseJavaWithJavac"


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


Solution

  • 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