How to solve the error FAILURE: Build failed with an exception. * Where: Script ‘C:\flutter\packages\flutter_tools\gradle\flutter.gradle’ line: 1005

Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

Error:

Where: Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1160 * What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'. > Process 'command 'C:\flutter\bin\flutter.bat'' finished with non-zero exit value 1 * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 22s Exception: Gradle task assembleDebug failed with exit code 1

Solution:

  1. Close project.
  2. Go to the project repository folder.
  3. Delete all generated files, for example:
  • .dart_tool
  • .idea
  • .build
  • .flutter-plugins
  • .flutter-plugins-dependencies
  • .metadata
  • .packages

Nothing should changed in your git changes due to .gitignore file

  1. Open Android Studio again
  2. Go to File->Invalidate Caches/Restart, then invalidate caches and restart

if your project structure is corrupted go to: File -> Close Project, close the project and reopen it, it should be back to normal.

  1. Run all the necessary scripts starting with:
  2. flutter pub get
  3. dart pub get

Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x