Skip to main content

Build Flutter app for linux-arm/arm64

Native Build#

Target(Linux ARM/ARM64)#

git clone https://github.com/flutter/flutter.git $HOME/development/flutter
cd $HOME/development/flutter \
&& git checkout stable
mkdir -p $HOME/development/flutter/bin/cache
export PATH=$PATH:$HOME/development/flutter/bin

Host(Linux x86_64)#

info

Read Build engine for linux-arm64 for out/linux_<profile/release>_<arm/arm64>

cd $HOME/flutter-engine/engine/src/out/linux_release_arm64
rsync -a dart-sdk <target user>@<target ip>:~/development/flutter/bin/cache

Target(Linux ARM/ARM64)#

cp $HOME/development/flutter/bin/internal/engine.version \
$HOME/development/flutter/bin/cache/engine-dart-sdk.stamp
$ flutter doctor
Building flutter tool...
โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
โ•‘ Welcome to Flutter! - https://flutter.dev โ•‘
โ•‘ โ•‘
โ•‘ The Flutter tool uses Google Analytics to anonymously report feature usage โ•‘
โ•‘ statistics and basic crash reports. This data is used to help improve โ•‘
โ•‘ Flutter tools over time. โ•‘
โ•‘ โ•‘
โ•‘ Flutter tool analytics are not sent on the very first run. To disable โ•‘
โ•‘ reporting, type 'flutter config --no-analytics'. To display the current โ•‘
โ•‘ setting, type 'flutter config'. If you opt out of analytics, an opt-out โ•‘
โ•‘ event will be sent, and then no further information will be sent by the โ•‘
โ•‘ Flutter tool. โ•‘
โ•‘ โ•‘
โ•‘ By downloading the Flutter SDK, you agree to the Google Terms of Service. โ•‘
โ•‘ Note: The Google Privacy Policy describes how data is handled in this โ•‘
โ•‘ service. โ•‘
โ•‘ โ•‘
โ•‘ Moreover, Flutter includes the Dart SDK, which may send usage metrics and โ•‘
โ•‘ crash reports to Google. โ•‘
โ•‘ โ•‘
โ•‘ Read about data we send with crash reports: โ•‘
โ•‘ https://flutter.dev/docs/reference/crash-reporting โ•‘
โ•‘ โ•‘
โ•‘ See Google's privacy policy: โ•‘
โ•‘ https://policies.google.com/privacy โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
Downloading Material fonts... 2,337ms
Downloading Gradle Wrapper... 64ms
Downloading package sky_engine... 1,139ms
Downloading flutter_patched_sdk tools... 3.1s
Downloading flutter_patched_sdk_product tools... 2,334ms
Downloading linux-x64 tools... 4.7s
Downloading linux-x64/font-subset tools... 1,701ms
Doctor summary (to see all details, run flutter doctor -v):
[โœ“] Flutter (Channel master, 1.25.0-9.0.pre.57, on Linux, locale C.UTF-8)
[โœ—] Android toolchain - develop for Android devices
โœ— Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, please use
`flutter config --android-sdk` to update to that location.
[โœ—] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[!] Android Studio (not installed)
[!] Connected device
! No devices available
! Doctor found issues in 4 categories.
flutter config --enable-linux-desktop

Host(Linux x86_64)#

cd $HOME/flutter-engine/engine/src/out/linux_debug_arm64
rsync -a flutter_linux \
flutter_tester \
font-subset \
icudtl.dat \
libflutter_linux_gtk.so \
gen/const_finder.dart.snapshot \
gen/frontend_server.dart.snapshot \
gen/flutter/lib/snapshot/isolate_snapshot.bin \
gen/flutter/lib/snapshot/vm_isolate_snapshot.bin \
<target user>@<target ip>:~/development/flutter/bin/cache/artifacts/engine/linux-arm64
rsync -a flutter_patched_sdk \
<target user>@<target ip>:~/development/flutter/bin/cache/artifacts/engine/common
cd $HOME/flutter-engine/engine/src/out/linux_profile_arm64
rsync -a flutter_linux gen_snapshot libflutter_linux_gtk.so \
<target user>@<target ip>:~/development/flutter/bin/cache/artifacts/engine/linux-arm64-profile
cd $HOME/flutter-engine/engine/src/out/linux_release_arm64
mv flutter_patched_sdk flutter_patched_sdk_product
rsync -a flutter_patched_sdk_product \
<target user>@<target ip>:~/development/flutter/bin/cache/artifacts/engine/common
rsync -a flutter_linux gen_snapshot libflutter_linux_gtk.so \
<target user>@<target ip>:~/development/flutter/bin/cache/artifacts/engine/linux-arm64-release

Target(Linux ARM/ARM64)#

flutter create sample \
&& cd sample

Run debug mode#

flutter run -d linux

Run release mode#

flutter build linux
./build/linux/release/bundle/sample

Build-troubleshoot#

flutter build linux --verbose

Run Without Xwindow(On console mode)#

xinit /path/to/sample/build/linux/release/bundle/sample
info

Run export DISPLAY=:0 when accessing target from host using ssh. Then execute flutter run.

Last updated on