3
votes

"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

3
first of all please open android module in Android studio and then run app it shows some relative error in logcat - Jaimil Patel
i already updated logcat pict. - Rendra Prames
image does not contains any emulator information and real device so please first connect with real device or emulator then update the pic - Jaimil Patel
my phone is connected, but in logcat showing "no connected device".. i updated picture - Rendra Prames
I am talking about Logcat window of Android Studio - Jaimil Patel

3 Answers

3
votes

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

0
votes

Flutter provides a command to update the Android SDK path:

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

0
votes

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.