Rendra Prames
Rendra Prames

Reputation: 29

How to fix "Finished with error: Gradle task assembleDebug failed with exit code -1" error when i run flutter project

"Finished with error: Gradle task assembleDebug failed with exit code -1"

I make a new basic flutter project, and I got this error when I run flutter doctor everything is well, no issues detected. I have tried flutter clean, and try to rebuild and the messages are the same. anyone can help me please to fix this problem.

error:

enter image description here

Flutter doctor:

enter image description here

logcat:

enter image description here

device connected:

enter image description here

Module Window: enter image description here

Upvotes: 2

Views: 1724

Answers (3)

Federick Jonathan
Federick Jonathan

Reputation: 2864

I got same error code a few days ago when I try to run all my Flutter projects. To make sure you encounter the same problem as I did;

First, go to your project directory -> open android folder -> check if there's a gradlew.bat file inside. <project_name>\android\gradlew.bat. If there's no such file, then you can follow along.

Here's what I did:

  1. Run flutter create -t <project_name>, by using this command, it will ensure that there will be gradlew.bat file inside the project.
  2. Go to that project directory <project_name>\android, copy that gradlew.bat file.
  3. Paste it to the same directory path (<project_name>\android) of one of your current not-working Flutter project.
  4. Try to run the flutter run command on that project.

Upvotes: 0

Jaimil Patel
Jaimil Patel

Reputation: 1347

Flutter provides a command to update the Android SDK path:

Use flutter config --android-sdk <path-to-your-android-sdk-path>

Upvotes: 0

Payam Zahedi
Payam Zahedi

Reputation: 855

Open your android folder with the android studio it'll help you to find out whats the issue. also, check this answer too.

Upvotes: 3

Related Questions