Hello Guys How are you all? Hope You all are fine. When I was trying to run my flutter app and suddenly I get the following error in my stack track. Finished with error: Gradle task assembleDebug failed with exit code 1 in flutter. So today Here I come with all possible solutions for this error.
We are providing you all possible solutions to solve this error. let’s start this article without wasting your time.
How Finished with error: Gradle task assembleDebug failed with exit code 1 Error Occurs ?
When I run my app following error occurs at my stack track. BUILD FAILED in 26s Finished with error: Gradle task assembleDebug failed with exit code 1
^ symbol: class NonNull location: package androidx.annotation C:\flutter\.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.9.0\android\src\main\java\io\flutter\plugins\firebase\cloudfirestore\CloudFirestorePlugin.java:10: error: cannot find symbol import androidx.annotation.Nullable;
^ symbol: class Nullable location: package androidx.annotation C:\flutter\.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.9.0\android\src\main\java\io\flutter\plugins\firebase\cloudfirestore\CloudFirestorePlugin.java:253: error: cannot find symbol
public void onFailure(@NonNull Exception e) {
^ symbol: class NonNull C:\flutter\.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.9.0\android\src\main\java\io\flutter\plugins\firebase\cloudfirestore\CloudFirestorePlugin.java:274: error: cannot find symbol
public Void apply(@NonNull Transaction transaction)
^ symbol: class NonNull C:\flutter\.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.9.0\android\src\main\java\io\flutter\plugins\firebase\cloudfirestore\CloudFirestorePlugin.java:272: error: cannot find symbol
@Nullable
^ symbol: class Nullable C:\flutter\.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.9.0\android\src\main\java\io\flutter\plugins\firebase\cloudfirestore\CloudFirestorePlugin.java:503: error: cannot find symbol
public void onFailure(@NonNull Exception e) {
^ symbol: class NonNull C:\flutter\.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.9.0\android\src\main\java\io\flutter\plugins\firebase\cloudfirestore\CloudFirestorePlugin.java:558: error: cannot find symbol
public void onFailure(@NonNull Exception e) {
^ symbol: class NonNull 7 errors
FAILURE: Build failed with an exception.
* What went wrong: Execution failed for task ':cloud_firestore:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* 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 26s Finished with error: Gradle task assembleDebug failed with exit code 1
How to Solve Finished with error: Gradle task assembleDebug failed with exit code 1 Error?
- How to Solve Finished with error: Gradle task assembleDebug failed with exit code 1 Error?
To Solve Finished with error: Gradle task assembleDebug failed with exit code 1 Error The solution Is very simple. Just update whatever dependency causes the error just update that dependency. in my case cloud_firestore plugin cause this error. I just updated my cloud_firestore-0.9.0 to cloud_firestore 2.2.2 in my pubspec.yaml file and then flutter clean & flutter run.
- Finished with error: Gradle task assembleDebug failed with exit code 1
To Solve Finished with error: Gradle task assembleDebug failed with exit code 1 Error The solution Is very simple. Just update whatever dependency causes the error just update that dependency. in my case cloud_firestore plugin cause this error. I just updated my cloud_firestore-0.9.0 to cloud_firestore 2.2.2 in my pubspec.yaml file and then flutter clean & flutter run.
Solution 1
The solution Is very simple. Just update whatever dependency causes the error just update that dependency. in my case cloud_firestore plugin cause this error.
I just updated my cloud_firestore-0.9.0 to cloud_firestore 2.2.2 in my pubspec.yaml file and then flutter clean & flutter run.
Solution 2
Just Migrate your project to android X
Open the Android portion of your Flutter project in Android Studio. Make sure you are using Android Studio 3.3. (I closed IntelliJ Idea altogether, opened Android Studio, clicked on File > Open, and navigated to the ~/IdeaProjects/[my_project]/android
folder in my Flutter project. Upon opening the Android project followed by Android Studio starting to sync it, a message/pop-up appeared asking if it could update the Gradle plugin, so I let it. It was upgraded to version 3.3.0.)
Add the following 2 lines to the bottom of the [my_project]/android/gradle.properties
file:
android.useAndroidX=true
android.enableJetifier=true
In the Android Studio main menus, select Refactor > Migrate to Androidx…, saving a backup of your project to a .zip file. Follow this with File > Save All and then quit Android Studio.
Solution 3
- Open the folder
C:\Users\{YourUserName}\.gradle\wrapper\dists
, then check the version - If it is an older version of Gradle, update it from https://gradle.org/ (Steps to download Gradle)
- Download the ZIP file of the latest version, and then unzip it and say yes to replacing any existing files.
- Open Android Studio and run
Summery
So, It’s All About This Error. I hope this tutorial helps you to solve your error. Please Comment Below if You stucks anywhere with my code.
Also Check Out Below Tutorials
- The argument type ‘PointerEvent’ can’t be assigned to the parameter type ‘PointerDownEvent’
- How to Change Border Color of ElevatedButton in Flutter
- Flutter-Unable to find bundled Java version after updated android studio Arctic Fox(2020.3.1) on M1 Apple Silicon
- How to show/hide password in TextFormField in flutter?
- How to upload images and file to a server in Flutter?
Leave a Reply