Dart snapshot generator failed with exit code -6 - android

I am trying to make a Android build from Android studio for flutter app but getting below error. How can I resolve the issue?
Current flutter version: 2.10.2
💪 Building with sound null safety 💪
../../third_party/dart/runtime/vm/compiler/aot/precompiler.cc: 3298: error: unreachable code
Dart snapshot generator failed with exit code -6
../../third_party/dart/runtime/vm/compiler/aot/precompiler.cc: 3298: error: unreachable code
Dart snapshot generator failed with exit code -6
../../third_party/dart/runtime/vm/compiler/aot/precompiler.cc: 3298: error: unreachable code
Dart snapshot generator failed with exit code -6
FAILURE: Build failed with an exception.
* Where:
Script '/Users/admin/Desktop/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1102
* What went wrong:
Execution failed for task ':app:compileFlutterBuildRelease'.
> Process 'command '/Users/admin/Desktop/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 39s
Running Gradle task 'assembleRelease'... 40.0s
Gradle task assembleRelease failed with exit code 1

Seems it was vm issue. There was some functions written in main.dart file and some of them was taking lot of memory. So I found solution by applying
#pragma('vm:never-inline')
above the functions which was taking memory.
I found those functions with running command flutter build apk --verbose

Related

I am trying to build an Android apk for google play console. When I run

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:compileFlutterBuildRelease'.
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 1m 45s
Running Gradle task 'assembleRelease'... 107.3s
Gradle task assembleRelease failed with exit code 1
PS C:\Users\Admin\Downloads\ct\gorun\gitlab\apps\wazeto-user>
tried flutter clean, flutter pub get this didn't worked. then i went for flutter pub upgrade --major-versions ... still shows the same error after flutter build apk
that happens sometimes because some issues wrong in the flutter sdk try to download the sdk again and replase with the current. or toggle the version with the FVM tool.
it will build with you and if you use for example 2.10.0 you can use also 2.10.3 it also will work.

[Flutter][APK]Dart snapshot generator failed with exit code -9

I had a Flutter app that was working just fine until today. I realized that the flutter build apk --release wasn't building the Flutter app with the latest code. Looked up on the internet. Did a flutter clean. Then flutter pub get. And then built the app again with flutter build apk --release. The following is the error I'm getting,
Current flutter version: 2.10.4
💪 Building with sound null safety 💪
Dart snapshot generator failed with exit code -9
Dart snapshot generator failed with exit code -9
FAILURE: Build failed with an exception.
* Where:
Script '/Users/exaltaretechnologiespvtltd./flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1102
* What went wrong:
Execution failed for task ':app:compileFlutterBuildRelease'.
> Process 'command '/Users/exaltaretechnologiespvtltd./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 49s
Running Gradle task 'assembleRelease'... 50.3s
Gradle task assembleRelease failed with exit code 1

Codepoint 984652 not found in font Flutter

Building with sound null safety
Codepoint 984652 not found in font, aborting.
FAILURE: Build failed with an exception.
Where:
Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1102
What went wrong:
Execution failed for task ':app:compileFlutterBuildRelease'.
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 41s
Running Gradle task 'assembleRelease'... 46.1s
Gradle task assembleRelease failed with exit code 1
try building your application with this flutter build apk --no-tree-shake-icons
There is an issue with icons in Flutter 2.10.0 which causes this error. I am assuming that you are using 2.10.0 version of Flutter.
This issue is resolved in Flutter 2.10.2. So, run Flutter upgrade in the terminal to solve the problem.

Flutter build error in "flutter build appbundle" command

Can't load Kernel binary: Invalid kernel binary format version.
Dart snapshot generator failed with exit code 254
Can't load Kernel binary: Invalid kernel binary format version.
Can't load Kernel binary: Invalid kernel binary format version.
Dart snapshot generator failed with exit code 254
Dart snapshot generator failed with exit code 254
FAILURE: Build failed with an exception.
* Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1035
* What went wrong:
Execution failed for task ':app:compileFlutterBuildRelease'.
> 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 7s
Running Gradle task 'bundleRelease'...
Running Gradle task 'bundleRelease'... Done 9.6s
Gradle task bundleRelease failed with exit code 1
when I try to run flutter build appbundle --no-sound-null-safety command than this error come. What is the solution for it?
Try these commands and try again:
flutter create .
flutter clean
flutter pub get

Codemagic flutter failed to build android

Whenever I run it it get stuck in android. This happened to me locally and I solve it doing flutter clean, which I don't know how to do in codemagic. The problem is that is nos building, heres the log.
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> java.net.URISyntaxException: Illegal character in opaque part at index 2: C:\\Users\\thech\\Downloads\\nueva_temporada-20210514T040146Z-001\\nueva_temporada\\build\\app\\intermediates\\flutter\\debug\\flutter_assets\\AssetManifest.json
* 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 30s
Running Gradle task 'assembleDebug'... 31.3s
Gradle task assembleDebug failed with exit code 1
Build failed :|
Failed to build for Android
any chance you have hardcoded path in your build.gradle or somewhere else? C:\\Users is not a valid path on Codemagic builder machines because it uses macOS or Linux

Categories

Resources