'Dart snapshot generator failed with exit code -6
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
Solution 1:[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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | apurv thakkar |
