close

[Solved] Finished with error: Gradle task assembleDebug failed with exit code 1

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

How to Solve Finished with error: Gradle task assembleDebug failed with exit code 1 Error?

Question: How to Solve Finished with error: Gradle task assembleDebug failed with exit code 1 Error?
Answer: 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:

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

  1. Open the folder C:\Users\{YourUserName}\.gradle\wrapper\dists, then check the version
  2. If it is an older version of Gradle, update it from https://gradle.org/ (Steps to download Gradle)
  3. Download the ZIP file of the latest version, and then unzip it and say yes to replacing any existing files.
  4. 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

Leave a Comment

%d bloggers like this: