Flutter build APK in the cloud
Do more with Build Flutter app Integrations
Run flutter build apk on Buddy's servers on every push, with the Flutter version you choose and no local Android SDK.
Use Build Flutter app with Build Android APK in Buddy CI/CDHow to run flutter build apk in a pipeline
The Build Flutter app action runs flutter build apk on Buddy's servers with the Flutter version you choose. Every push produces the same APK, and you don't need a local Android SDK or a matching JDK.
- Create a project in Buddy and connect the repository from GitHub, GitLab or Bitbucket.
- Add a pipeline with an On push trigger.
- Add Build Flutter app. Pick the Flutter version that matches
environment: sdkinpubspec.yaml, and use these commands:
flutter pub get
flutter build apk --release
$$- The APK lands in
build/app/outputs/flutter-apk/app-release.apk. - Add Sign APK with your keystore, then save the file as an artifact or publish it to Google Play.
When this happens...
GitHub Push / Bitbucket Push / Git Push
Then do this...
Build Flutter app
Sign APK
APK or App Bundle?
Google Play requires an App Bundle (.aab) for new apps. Use the APK for testing, sideloading and stores other than Google Play. For Play, run flutter build appbundle and sign the result with Sign Bundle.
To get smaller files, flutter build apk --split-per-abi builds a separate APK for each CPU architecture (armeabi-v7a, arm64-v8a, x86_64).
How long it takes
A new app from flutter create (Flutter 3.41.6) built on the smallest machine (2 vCPU, 3 GB RAM). The first run took 3 min 6 s, because Flutter installs the Android NDK, Build-Tools and CMake on first use. With /root/.pub-cache and /root/.gradle cached, the next run took 53 s and produced a 42.6 MB release APK.
Add -v to flutter build apk if you want Gradle progress in the log. Without it, the NDK download looks like a hang.
Common errors
- Google Play rejects the APK as debug-signed. The default Flutter template signs release builds with the debug key (
signingConfig = signingConfigs.debuginandroid/app/build.gradle). Add your release keystore throughkey.propertiesor use the Sign APK action. The current Dart SDK version is X. Because app requires SDK version >=Y. The Flutter version in the action is older thanpubspec.yamlexpects. Pick a newer one.Gradle build daemon disappeared unexpectedly. Gradle ran out of memory. Keeporg.gradle.jvmargsinandroid/gradle.propertiesbelow the machine's RAM (on 3 GB we used-Xmx1536m), or raise the pipeline resources.
More Flutter options, including iOS builds on macOS, are on the Flutter CI/CD page. The Android pipeline guide covers signing and the Play Store upload. Building a native Android project from GitHub? See GitHub to APK. Got a ZIP from an AI app builder? Follow the ZIP to APK tutorial.