How to compile android-arm64-release/linux-arm64/gen_snapshot from flutter engine

612 views Asked by At

While building flutter apk on termux proot Ubuntu in release mode. Flutter gives following error about missing gen_snapshot.



anil@localhost:~/myapp/android$ ./gradlew assembleRelease

                                                     > Task :app:compileFlutterBuildRelease

Can't load Kernel binary: Invalid SDK hash.          Dart snapshot generator failed with exit code 254    Target android_aot_release_android-arm failed: ProcessException: Failed to find "/home/anil/flutter/bin/cache/artifacts/engine/android-arm-release/linux-arm64/gen_snapshot" in the search path.

  Command: /home/anil/flutter/bin/cache/artifacts/engine/android-arm-release/linux-arm64/gen_snapshot

Target android_aot_release_android-arm64 failed: ProcessException: Failed to find "/home/anil/flutter/bin/cache/artifacts/engine/android-arm64-release/linux-arm64/gen_snapshot" in the search path.

  Command: /home/anil/flutter/bin/cache/artifacts/engine/android-arm64-release/linux-arm64/gen_snapshot

Target android_aot_release_android-x64 failed: Exception: AOT snapshotter exited with code 254

                                                     

> Task :app:compileFlutterBuildRelease FAILED

FAILURE: Build failed with an exception.

* Where:

Script '/home/anil/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1159

* What went wrong:

Execution failed for task ':app:compileFlutterBuildRelease'.

> Process 'command '/home/anil/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 1m 40s

2 actionable tasks: 1 executed, 1 up-to-date

anil@localhost:~/myapp/android$

I tried to copy ~/flutter/bin/cache/artifacts/engine/linux-arm64-release/gen_snapshot to~/flutter/bin/cache/artifacts/engine/android-arm64-release/linux-arm64/gen_snapshot but this didn't work. Building flutter apk on arm64 Linux require specific android/gen_snapshot for compiling apk in release mode. I don't know how but compiling apk in debug mode work on arm64 Linux.

0

There are 0 answers