Flutter 无法构建 android-arm64,android-x64 发布版本

Flutter fails to build android-arm64, android-x64 release versions

我尝试将我的 flutter 应用程序构建为 Android App Bundle,但构建失败

flutter build appbundle --target-platform android-arm64

 flutter build appbundle --target-platform android-x64

有一个例外(两个命令都一样)

c:\b\s\w\ir\cache\builder\src\third_party\dart\runtime\vm\compiler\backend\il.h: 999: error: unreachable code
Dart snapshot generator failed with exit code -1073740791
Target android_aot_release_android-x64 failed: Exception: AOT snapshotter exited with code -1073740791
build failed.

FAILURE: Build failed with an exception.

* Where:
Script 'D:\Flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 882

* What went wrong:
Execution failed for task ':app:compileFlutterBuildRelease'.
> Process 'command 'D:\Flutter\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 30s
Running Gradle task 'bundleRelease'...
Running Gradle task 'bundleRelease'... Done                        31,1s
Gradle task bundleRelease failed with exit code 1

但是,为 android-arm 构建工作正常:
flutter build appbundle --target-platform android-arm

运行 flutter doctor -v 工作正常。

[√] Flutter (Channel stable, v1.17.5, on Microsoft Windows [Version 10.0.18363.959], locale de-DE)
    • Flutter version 1.17.5 at D:\Flutter\flutter
    • Framework revision 8af6b2f038 (4 weeks ago), 2020-06-30 12:53:55 -0700
    • Engine revision ee76268252
    • Dart version 2.8.4

 
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.1)
    • Android SDK at D:\Android\Android_Development_Requirements\Android\Sdk
    • Platform android-29, build-tools 29.0.1
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
    • All Android licenses accepted.

[√] Android Studio (version 3.6)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 46.0.1
    • Dart plugin version 192.8052
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)

我真的不知道为什么,有人知道这是什么原因吗?

问题似乎与 moor_ffi 库有关,虽然我无法弄清楚具体原因,但是切换到 moor_flutter 修复了它。