I am having the following while compiling my flutter project:
FAILURE: Build failed with an exception.
*** What went wrong:**
A problem occurred configuring project ‘:cloud_firestore’.
Failed to create Jar file C:Users.gradlecachesjars-8fef84f4f98be9f93b0b593ccb1e3e207lint-model-31.1.2.jar.
Failed to notify project evaluation listener.
** > Could not get unknown property ‘android’ for project ‘:cloud_firestore’ of type org.gradle.api.Project.**
** > Could not find method implementation() for arguments [project ‘:firebase_core’] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.**
** > Could not get unknown property ‘android’ for project ‘:cloud_firestore’ of type org.gradle.api.Project.**
*** Try:**
Run with –stacktrace option to get the stack trace. Run with –info or –debug option to get more log output. Run with –scan to get full insights.
*** Get more help at https://help.gradle.org**
BUILD FAILED in 3s
Running Gradle task ‘assembleDebug’… 4.8s
Exception: Gradle task assembleDebug failed with exit code 1
It started after i added firebase_storage dependency and this issue is now persisting .
I have tried updating plugins and sdks from android studio as well puting the latest versions of dependencies in pubsec.yaml file but it is of no avail. I have repaired pub cache as well and gone through every possible solution available on stackoverflow and github community but the error has not been resolved.
2
Answers
Dear stackoverflow community. After encountering this problem myself and seeing on the internet that many others have also faced a similar issue here is how I solved it, you have to follow these basic steps and you are good to go: 1)Update your sdks in android studio 2)Apply the latest versions of dependencies in your project pubsec.yaml file 3)Delete your ~/.graddle/cache folder in its entirety 4)Run flutter stable channel command(I ran it in in my project folder) 6)Run flutter upgrade(ran it in project folder) 7)Run the flutter run command and hopefully, it will also solve your problem.
The process may take time so patience is the key. My problem started after I added a firebase_storage dependency to my project and this error usually appears after you add a firebase dependency.
Happy coding to you all, godspeed.
I recommend to using flutterfire
FlutterFire is a set of Flutter plugins which connect your Flutter application to Firebase.
You try to follow that docs getting started and If you finished, you just enter
flutterfire configure
Then you’re project is done to firebase configuration!!
It’s easy to install and easy to apply your project
reference: flutterfire docs