Build and release an Android app


Add a launcher icon First

When a new Flutter app is created, it has a default launcher icon. To customize this icon, you might want to check out the flutter_launcher_icons package.

Alternatively, you can do it manually using the following steps:

  1. Review the Material Design product icons guidelines for icon design.

  2. In the <app dir>/android/app/src/main/res/ directory, place your icon files in folders named using configuration qualifiers. The default mipmap- folders demonstrate the correct naming convention.

  3. In AndroidManifest.xml, update the application tag’s android:icon attribute to reference icons from the previous step (for example, <application android:icon="@mipmap/ic_launcher" ...).

  4. To verify that the icon has been replaced, run your app and inspect the app icon in the Launcher.



Building the app for release

You have two possible release formats when publishing to the Play Store.

  • App bundle (preferred)

  • APK

Note: The Google Play Store prefers the app bundle format. For more information, see Android App Bundle and About Android App Bundles.

Warning: Recently, the Flutter team has received several reports from developers indicating they are experiencing app crashes on certain devices on Android 6.0. If you are targeting Android 6.0, use the following steps:

  • If you build an App Bundle Edit android/gradle.properties and add the flag: android.bundle.enableUncompressedNativeLibs=false.

  • If you build an APK Make sure android/app/src/AndroidManifest.xml doesn’t set android:extractNativeLibs=false in the <application> tag.

For more information, see the public issue.


Build an app bundle

This section describes how to build a release app bundle. If you completed the signing steps, the app bundle will be signed. At this point, you might consider obfuscating your Dart code to make it more difficult to reverse engineer. Obfuscating your code involves adding a couple flags to your build command, and maintaining additional files to de-obfuscate stack traces.

From the command line:

  1. Enter cd <app dir>(Replace <app dir> with your application’s directory.)

  2. Run flutter build appbundle(Running flutter build defaults to a release build.)

  3. The release bundle for your app is created at <app dir>/build/app/outputs/bundle/release/app.aab.

  4. By default, the app bundle contains your Dart code and the Flutter runtime compiled for armeabi-v7a (ARM 32-bit), arm64-v8a (ARM 64-bit), and x86-64 (x86 64-bit).

  5. Test the app bundle

  6. An app bundle can be tested in multiple ways—this section describes two.

  7. Offline using the bundle tool

  8. If you haven’t done so already, download bundletool from the GitHub repository.

  9. Generate a set of APKs from your app bundle.

  10. Deploy the APKs to connected devices.

  11. Online using Google Play

  12. Upload your bundle to Google Play to test it. You can use the internal test track, or the alpha or beta channels to test the bundle before releasing it in production.

  13. Follow these steps to upload your bundle to the Play Store.

  14. Build an APK

  15. Although app bundles are preferred over APKs, there are stores that don’t yet support app bundles. In this case, build a release APK for each target ABI (Application Binary Interface).

  16. If you completed the signing steps, the APK will be signed. At this point, you might consider obfuscating your Dart code to make it more difficult to reverse engineer. Obfuscating your code involves adding a couple flags to your build command.

  17. From the command line:

  18. Enter cd <app dir>(Replace <app dir> with your application’s directory.)

  19. Run flutter build apk --split-per-abi(The flutter build command defaults to --release.)

This command results in three APK files:

  • <app dir>/build/app/outputs/apk/release/app-armeabi-v7a-release.apk

  • <app dir>/build/app/outputs/apk/release/app-arm64-v8a-release.apk

  • <app dir>/build/app/outputs/apk/release/app-x86_64-release.apk

Removing the --split-per-abi flag results in a fat APK that contains your code compiled for all the target ABIs. Such APKs are larger in size than their split counterparts, causing the user to download native binaries that are not applicable to their device’s architecture.


Install an APK on a device

Follow these steps to install the APK on a connected Android device.

From the command line:

  1. Connect your Android device to your computer with a USB cable.

  2. Enter cd <app dir> where <app dir> is your application directory.

  3. Run flutter install.

Publishing to the Google Play Store

For detailed instructions on publishing your app to the Google Play Store, see the Google Play launch documentation.

How do I build a release from within Android Studio?

In Android Studio, open the existing android/ folder under your app’s folder. Then, select build.gradle (Module: app) in the project panel:


Next, select the build variant. Click Build > Select Build Variant in the main menu. Select any of the variants in the Build Variants panel (debug is the default):


The resulting app bundle or APK files are located in build/app/outputs within your app’s folder.

Built build/app/outputs/flutter-apk/app-release.apk