13
votes

FAILURE: Build failed with an exception.

  • Where: Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 904

  • What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'.

Process 'command 'C:\src\flutter\bin\flutter.bat'' finished with non-zero exit value 1

I tried flutter clean / pug get and update but application is still not working.

5
did u solve the problem?? Can u please tell me how u solved it - Jagadish

5 Answers

1
votes

Try this:

flutter clean

flutter pub get

Once these two commands have been successfully executed, launch your project ... This is what I did and it worked.

0
votes

try running

flutter clean
flutter upgrade

it work for me.

0
votes

In Android Studio I did the following:

  • flutter clean
  • flutter pub get
  • Invalidate Caches and Restart (from the File menu)

After all that, I re-ran the flutter build appbundle command and it worked.

0
votes

My antivirus was blocking dart from reading asset images, i allowed it from there and the error got fixed!!

-1
votes

I've had the same error and tried the following:

  • uninstall android studio and delete all folders regarding this
  • clean up registry
  • review path for environment variables
  • give all sorts of flutter commands (clean, update, and so on)
    Until I realized this is an error on the flutter folder, so basically this is due to some force close some operations and the variables that write in the 'flutter.gradle' file are obsolete. What I did and worked for me:
  1. Make sure you have all android studio processes closed.
  2. Delete the flutter folder (the one that you defined as for the PATH)
  3. Extract in the same location the flutter folder from the SDK archive.
  4. Enjoy :)

Powershell commands Example:
Remove-Item 'D:\DEV\flutter'
Expand-Archive -LiteralPath 'C:\Archives\flutter_windows_1.22.3-stable.Zip' -DestinationPath D:\DEV