Android
Android gets a Kotlin and JNI plugin over the same renderer core. Gradle runs the setup before the native build, so on Linux there’s nothing to run by hand. On a Mac there’s one step first.
Which machine
Section titled “Which machine”| Your machine | |
|---|---|
| Mac, Apple silicon | Yes, after the Mac setup |
| Linux, x86_64 | Yes |
| Linux, arm64 | No. The setup fetches an x86_64 matc, which won’t run there |
| Windows | No. The setup has no matc for a Windows machine, and stops with no matc for host |
The reason is the same as everywhere else: Filament’s matc has to run on the
machine doing the build. The Android release doesn’t carry one, so the setup
borrows the Mac’s, or on Linux fetches Google’s x86_64 Linux release just for
its matc.
What you need
Section titled “What you need”| Android Studio, or its command line tools | With the SDK for Android 16 (API 36) |
| NDK 28.2.13676358 | The version the plugin pins, which is also Flutter 3.47’s default |
| CMake 3.22.1 | The Android SDK’s own copy |
| JDK 17 or newer | The plugin compiles for Java 17, and CI builds with Temurin 17. Flutter uses Android Studio’s bundled JDK by default, which is newer |
xxd |
Turns compiled materials into C arrays. macOS has it. On Debian or Ubuntu, sudo apt-get install xxd |
Your app can target Android 7.0 (API 24) and up, which is Flutter’s own floor, so a new project needs no change.
The NDK and CMake come from the SDK Manager, in Android Studio or on the command line:
yes | "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" --install "ndk;28.2.13676358" "cmake;3.22.1"flutter doctor --android-licensesANDROID_HOME is wherever your SDK lives. Android Studio puts it in
~/Library/Android/sdk on a Mac and ~/Android/Sdk on Linux.
On a Mac, run the Mac setup first
Section titled “On a Mac, run the Mac setup first”On a Mac, the Android setup takes its matc from the Mac setup’s download
rather than fetching another. So run the loop from
macOS and iOS first, even if you’re
only building for Android. Without it, the build stops with a message that
ends run ../darwin/setup.sh first.
Running it
Section titled “Running it”The plugin is built for arm64-v8a only, so it runs on a phone, or on an
emulator with an arm64 system image. An Apple silicon Mac’s emulator is arm64,
so it runs there.
flutter devicesflutter run -d <id>The build CI runs is:
flutter build apk --debug --target-platform=android-arm64The first build downloads Filament’s Android release, 58 MB. On Linux it
downloads the Linux release too, 52 MB, for its matc. It compiles the
materials for Vulkan and OpenGL ES.
What to expect
Section titled “What to expect”Vulkan is the default, and reaches feature level 3, so Android gets the standard lit surface rather than the slimmer one the iOS simulator gets.
It has drawn on a Galaxy S24+ running Android 16, on Vulkan at feature level 3, with the engine up in 79 milliseconds. It has also drawn on the emulator, through SwiftShader, which is a software renderer, so the emulator’s timings say nothing about a phone. CI builds the APK on every change but doesn’t run it, so the on-device check is still done by hand.
