Search code examples
flutterdartflutter-linux

How to run a standalone linux app built with flutter?


I have built a linux app with flutter using : flutter build linux in my ubuntu VM.

My goal is to run this linux app in an embbeded device so i need to copy the required files to this device (running under linux) and then execute the equivalent of main.dart in the embbeded device.

I am very new to this, so what are the directories / files needed to run the standalone linux app ?

I see a bundle directory inside the /build/linux/x64 folder after running flutter build linux but i don't understand any files written inside / how to execute the whole app... And even if it's the correct directory to copy in my embbeded device.

EDIT : Running the app by trying to execute ./my_app_name on the corresponding file gives the following error :

-bash: ./my_app_name: cannot execute binary file: Exec format error

And i am guessing this is a not a shell script...


Solution

  • After running the command flutter build linux, you should find all the required files to run it in build/linux/release/bundle

    Just copying/pasting it on your device shall work (if the device is supported).

    There is an official guide explaining how to build and release your app onto the Snap Store: https://flutter.dev/docs/deployment/linux

    Important note :
    As described in the official documentation, a Flutter app supports Linux Debian, 64-bit. Meaning that if you try to run your app on a 32-bit distribution, it won't start.