-
Notifications
You must be signed in to change notification settings - Fork 128
Building Flutter apps
This page describes how to build Fluter apps.
See also: Desktop support for Flutter
$ git clone https://github.com/flutter/flutter
$ sudo mv flutter /opt/
$ export PATH=$PATH:/opt/flutter/bin
$ flutter config --enable-linux-desktop
$ flutter doctor
Please note that you must use the same version (channel) that you built Flutter embedder for. I recommend that you use the latest version of the master channel for both the SDK and Flutter Engine. See also: Building Flutter Engine
Here introduce how to build the flutter sample app.
This is the method when the build machine and the target machine are the same. (x64 targets on x64 hosts / for Arm64 targets on Arm64 hosts)
Note that you need to build Flutter apps in the same mode(release/debug) libflutter_engine.so
was built. It means you need to build Flutter apps in the release mode if you use libflutter_engine.so
was built in release mode.
$ flutter create sample
$ cd sample/$ cd sample/
$ flutter build linux
The build result: build/linux/{cpu-arch}/release/bundle/
$ flutter create sample
$ cd sample/$ cd sample/
$ flutter build linux --debug
The build result: build/linux/{cpu-arch}/debug/bundle/
Also, You can do the following steps on both x64 and arm64 hosts. In debug mode, the Flutter bundle artifacts are not architecturally different between x64 and arm64.
$ flutter build bundle --asset-dir=./bundle/data/flutter_assets
$ cp <path_to_flutter_sdk_install>/bin/cache/artifacts/engine/linux-*/icudtl.dat ./bundle/data
Comming soon. We are contributing to support this now. See: https://github.com/flutter/flutter/issues/74929