3

"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

Nikos Hidalgo
  • 3,094
  • 9
  • 17
  • 30

3 Answers3

3

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

Payam Zahedi
  • 601
  • 4
  • 15
0

Flutter provides a command to update the Android SDK path:

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

Jaimil Patel
  • 1,058
  • 4
  • 11
0

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.
Federick Jonathan
  • 2,105
  • 2
  • 8
  • 20