[Solved] How to solve Execution failed for task ‘:app:compileFlutterBuildDebug’ in Flutter

Hello Guys How are you all? Hope You all are fine. When I was trying to run my flutter app and suddenly I get the following error in mine stack track. Execution failed for task ‘:app:compileFlutterBuildDebug’ in flutter. So today Here I come with all possible solutions for this error.

We are providing you all possible solutions to solve this error. let’s start this article without wasting your time.

How Execution failed for task ‘:app:compileFlutterBuildDebug’ Error occurs ?

When I was trying to run my flutter app and suddenly I get the following error in mine stack track

FAILURE: Build failed with an exception.

* Where:
Script 'C:\Users\IMBA\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 882

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\Users\IMBA\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 16s
Exception: Gradle task assembleDebug failed with exit code 1

How to Solve Execution failed for task ‘:app:compileFlutterBuildDebug’ ?

Question: How to Solve Execution failed for task ‘:app:compileFlutterBuildDebug’ ?
Answer: To Solve This Error Go to the root of your project directory. Just delete pubspec.lock file. Now run pub get in your projects terminal. And then build the project again. That’s it. our Error must be solved or else used below solutions.

Solution 1

Solution That Worked For me is

  1. Go to the root of your project directory.
  2. Just delete pubspec.lock file.
  3. Now run pub get in your projects terminal.
  4. And then build the project again.
  5. That’s it. our Error must be solved or else used below solutions.

Solution 2

Try the following:

  1. Go to pubspec.yaml file in android studio.
  2. try doing “packages get”
  3. and then build the project again.
  4. Hope this resolves!

Solution 3

Removing .gradle folder helped

  1. Close android studio.
  2. Remove whole .gradle folder.
  3. Open Android studio and build.

Solution 4

Most of the time for me it’s like

  • Misspelled assets name
  • Non-Existing asset/directory name

Summery

So it’s all About All possible solutions. Hope this above all solution helped you a lot. Comment below Your thoughts and your queries. Comment Below on your suggestion.

Check Out Below Article

Milan Dhameliya is an Information Technology Engineer. By profession, he is a Full Stack developer with knowledge of multiple back-end platforms (e.g., PHP, Node.js, Python) and frontend Flutter frameworks.

Leave a Comment