Flutter Doctor输出:
[✓] Flutter (Channel master, 1.19.0-2.0.pre.193, on Linux, locale pl_PL.UTF-8) • Flutter version 1.19.0-2.0.pre.193 at /home/michal/android/flutter • Framework revision fed18fc433 (3 hours ago), 2020-05-29 03:43:01 -0400 • Engine revision 17737e6fd4 • Dart version 2.9.0 (build 2.9.0-11.0.dev 6489a0c68d) [✓] Android toolchain - develop for Android devices (Android SDK version 29.0.0-rc2) • Android SDK at /home/michal/Android/Sdk • Platform android-29, build-tools 29.0.0-rc2 • ANDROID_HOME = /home/michal/Android/Sdk • Java binary at: /home/michal/android/studio/jre/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211) • All Android licenses accepted. [✓] Chrome - develop for the web • Chrome at google-chrome [✓] Linux toolchain - develop for Linux desktop • clang version 9.0.1-12 • cmake version 3.16.3 • ninja version 1.10.0 [✓] Android Studio (version 3.6) • Android Studio at /home/michal/android/studio • Flutter plugin version 45.1.1 • Dart plugin version 192.8052 • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211) [✓] VS Code (version 1.45.1) • VS Code at /usr/share/code • Flutter extension version 3.8.1 [✓] Connected device (4 available) • Android SDK built for x86 64 • emulator-5554 • android-x64 • Android 10 (API 29) (emulator) • Linux • Linux • linux-x64 • Linux • Web Server • web-server • web-javascript • Flutter Tools • Chrome • chrome • web-javascript • Google Chrome 84.0.4147.21 dev • No issues found!
我的应用程序编译成功,我可以运行它,而flutter run -d Linux
没有任何问题。但是,当我尝试运行直接编译的可执行文件时,这种方法不起作用,在这种情况下,我会收到错误消息:
embedder.cc (781): 'FlutterEngineInitialize' returned 'kInvalidArguments'. Not running in AOT mode but could not resolve the kernel binary. Failed to start Flutter engine: error 2 Failed to create window.
要编译的命令:
flutter build linux
有人建议如何使其作为独立应用程序运行吗?
答案 0 :(得分:4)
听起来您正在尝试运行构建输出顶层的可执行文件。相反,您需要在构建目录的bundle
子目录中运行副本,该子目录中的所有支持文件都位于正确的相对位置。
一旦Linux进一步发展,将会在某处记录有关如何使用build目录中内容的详细信息。
有人建议如何使其作为独立应用程序运行吗?
整个bundle
目录是独立应用程序。如果您要把所有内容都放在一个可执行文件中而又不需要任何支持文件,那是不可能的。