在发布模式下在 termux proot Ubuntu 上构建 flutter apk。 Flutter 给出以下关于缺少 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$
我试图将 ~/flutter/bin/cache/artifacts/engine/linux-arm64-release/gen_snapshot 复制到 ~/flutter/bin/cache/artifacts/engine/android-arm64-release/linux-arm64/gen_snapshot 但是这个没用。在 arm64 Linux 上构建 flutter apk 需要特定的 android/gen_snapshot 才能在发布模式下编译 apk。我不知道如何在调试模式下编译 apk 在 arm64 Linux 上工作。