Linux Fultter desktop - unable to run app from compiled executable, flutter run works

1,719

It sounds like you are trying to run the executable that's at the top level of the build output. You need to instead run the copy in the bundle subdirectory of the build directory, which has all the supporting files in the correct relative locations.

Once Linux is further along, details of how to use what's in the build directory will be documented somewhere.

Any suggestion how to get it running as standalone app?

The bundle directory as a whole is the standalone app. If you mean having everything in a single executable file without any supporting files needed, that's not possible.

Share:
1,719
user1209216
Author by

user1209216

Updated on December 21, 2022

Comments

  • user1209216
    user1209216 over 1 year

    Flutter doctor output:

    [✓] 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!

    My app compiles succesfully and I am able to run it without any issues with flutter run -d Linux. However, that does not work when I try to run directly compiled executable, in this case I'm getting error message:

    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.
    

    Command to compile: flutter build linux

    Any suggestion how to get it running as standalone app?

    • dev-aentgs
      dev-aentgs almost 4 years
      what is the command you used for generating the executable?
    • user1209216
      user1209216 almost 4 years
      Question updated
    • dev-aentgs
      dev-aentgs almost 4 years
      from the documentation Building In addition to linking the Flutter library, your application will need to bundle your Flutter assets (as created by flutter build bundle). On Windows and Linux you will also need the ICU data from the Flutter engine (look for icudtl.dat under the bin/cache/artifacts/engine directory in your Flutter tree).
  • user1209216
    user1209216 almost 4 years
    You are right. I missed that, because on Windows there's no 'bundle' directory, so I wrongly assumed Linux executable is top level too