Exception: Gradle task assembleDebug failed with exit code 1 finished with non-zero exit value 1 - flutter

FAILURE: Build failed with an exception.
Where:
Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 991
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 17s

check if you can update your flutter version
Also you could try flutter clean, and then flutter pub get

Related

Script 'C:\Flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1159 flutter

Since yesterday, when I try to run my Flutter project, I encounter the following error. But when I don't use Hive and Hive_Flutter package, this error is solved. Thank you for helping me.
Script 'C:\Flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1159
What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command 'C:\Flutter\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 12s
Exception: Gradle task assembleDebug failed with exit code 1

Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1156?

FAILURE: Build failed with an exception.
Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1156
What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command 'C:\src\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 32s
Exception: Gradle task assembleDebug failed with exit code 1

When I try run a cloned flutter project. I get this exception > Execution failed for task ':app:compileFlutterBuildDebug'

FAILURE: Build failed with an exception.
Where:
Script '/home/joker/snap/flutter/common/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1159
What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command '/home/joker/snap/flutter/common/flutter/bin/flutter'' 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 48s
Exception: Gradle task assembleDebug failed with exit code 1

I am seeing this error "Execution failed for task ':app:compileFlutterBuildDebug'."

I have run flutter upgrade after that it told me to Flutter App Migration from Previous Version (Android Embedding V2), and after doing it, I am seeing this error.
Error image
error message
[FAILURE: Build failed with an exception.
Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1102
What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command 'C:\src\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 32s
Exception: Gradle task assembleDebug failed with exit code 1

How Can solve it?

When I try to run main.dart in USB device (Nokia 3.1 Plus) I have this in the Debug Console :
FAILURE: Build failed with an exception.
Where:
Script 'C:\src\flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 769
What went wrong:
Execution failed for task ':app:compileFlutterBuildDebugArm64'.
Process 'command 'C:\src\flutter\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 37s
Gradle task assembleDebug failed with exit code 1
flutter doctor shows any problem
Where:
Script 'C:\src\flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 769
What went wrong:
Execution failed for task ':app:compileFlutterBuildDebugArm64'.
Process 'command 'C:\src\flutter\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 37s
Gradle task assembleDebug failed with exit code 1