I am trying to build an android apk, when I run the app or flutter build apk the following error occurs, i'm using flutter 3.0.5.
💪 Building with sound null safety 💪
FAILURE: Build failed with an exception.
* Where:
Script '/Users/edgar/Documents/tools/flutter-35/packages/flutter_tools/gradle/flutter.gradle' line: 1156
* What went wrong:
Execution failed for task ':app:compileFlutterBuildRelease'.
> Process 'command '/Users/edgar/Documents/tools/flutter-35/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 45s
Running Gradle task 'assembleRelease'... 47,0s
Gradle task assembleRelease failed with exit code 1
Related
Command: flutter run --flavor dev --no-sound-null-safety
FAILURE: Build failed with an exception.
Where:
Script '/Users/petodavid/Developer/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1156
What went wrong:
Execution failed for task ':app:compileFlutterBuildDevDebug'.
Process 'command '/Users/petodavid/Developer/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 12s
Exception: Gradle task assembleDevDebug failed with exit code 1
I also created a github issue: https://github.com/flutter/flutter/issues/103578
I am trying to use my physical device for a flutter application, I am doing this through visual studio code.
flutter run --flavor=staging
OP: `FAILURE: Build failed with an exception.
Where:
Script 'C:\Users\Anand\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 991
What went wrong:
Execution failed for task ':app:compileFlutterBuildStagingDebug'.
Process 'command 'C:\Users\Anand\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 2m 6s
Running Gradle task 'assembleStagingDebug'...
Running Gradle task 'assembleStagingDebug'... Done 134.1s
Exception: Gradle task assembleStagingDebug failed with exit code 1`
What should be done in this case?
Thanks
FAILURE: Build failed with an exception.
Where:
Script 'C:\Users\wasiq\Downloads\flutter_windows_1.22.2-stable\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1035
What went wrong:
Execution failed for task ':app:compileFlutterBuildRelease'.
Process 'command 'C:\Users\wasiq\Downloads\flutter_windows_1.22.2-stable\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 11m 3s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 664.8s
Gradle task assembleRelease failed with exit code 1
After I updated my studio flutter stops to run and error message appeared
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
* 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 47s
Exception: Gradle task assembleDebug failed with exit code 1
how to fix this issue.
stack trace
I also had this issue, please run
flutter doctor
Check all cases are dismissed. If not solve those first. it should work then
> Task :app:bundleReleaseJsAndAssets FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
> Process 'command 'npx.cmd'' 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 1m 33s
1 actionable task: 1 executed
It seems it's a problem with your build.gradle version at root :
1-Open Android Studio
2-Open the android folder of you project
3-android studio will upgrade the gradle version automatically (make sure it does)
4-try again to generate apk