Build the App for Release for Android

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

  1. App bundle (preferred)
  2. APK

Note: The Google Play Store prefers the app bundle format. To learn more, check out About Android App Bundles.

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 [project]
  2. Run flutter build appbundle
    (Running flutter build defaults to a release build.)

The release bundle for your app is created at [project]/build/app/outputs/bundle/release/app.aab.

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)
  • x86-64 (x86 64-bit)

Test the App Bundle

An app bundle can be tested in multiple ways. This section describes two.

Offline using the bundle tool

  1. If you haven't done so already, download bundletool from the GitHub repository.
  2. Generate a set of APKs from your app bundle.
  3. Deploy the APKs to connected devices.

Online using Google Play

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.

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

Build an APK

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).

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.

From the command line:

  1. Enter cd [project].
  2. Run flutter build apk --split-per-abi
    (The flutter build command defaults to --release.)

This command results in three APK files:

  • [project]/build/app/outputs/apk/release/app-armeabi-v7a-release.apk
  • [project]/build/app/outputs/apk/release/app-arm64-v8a-release.apk
  • [project]/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 [project].
  3. Run flutter install.

Publish to the Google Play Store

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

Update the App's Version Number

The default version number of the app is 1.0.0. To update it, navigate to the pubspec.yaml file and update the following line:

version: 1.0.0+1

Register your app on App Store Connect

Video overview

For those who prefer video over text, the following video covers the same material as this guide.

Manage your app's life cycle on App Store Connect (formerly iTunes Connect). You define your app name and description, add screenshots, set pricing, and manage releases to the App Store and TestFlight.

Registering your app involves two steps: registering a unique Bundle ID, and creating an application record on App Store Connect.

For a detailed overview of App Store Connect, see the App Store Connect guide.

Register a Bundle ID

Every iOS application is associated with a Bundle ID, a unique identifier registered with Apple. To register a Bundle ID for your app, follow these steps:

  1. Open the App IDs page of your developer account.
  2. Click + to create a new Bundle ID.
  3. Enter an app name, select Explicit App ID, and enter an ID.
  4. Select the services your app uses, then click Continue.
  5. On the next page, confirm the details and click Register to register your Bundle ID.

Create an application record on App Store Connect

Register your app on App Store Connect:

  1. Open App Store Connect in your browser.
  2. On the App Store Connect landing page, click My Apps.
  3. Click + in the top-left corner of the My Apps page, then select New App.
  4. Fill in your app details in the form that appears. In the Platforms section, ensure that iOS is checked. Since Flutter does not currently support tvOS, leave that checkbox unchecked. Click Create.
  5. Navigate to the application details for your app and select App Information from the sidebar.
  6. In the General Information section, select the Bundle ID you registered in the preceding step.

For a detailed overview, see Add an app to your account.

Review Xcode project settings

This step covers reviewing the most important settings in the Xcode workspace. For detailed procedures and descriptions, see Prepare for app distribution.

  1. Open the default Xcode workspace in your project by running open ios/Runner.xcworkspace in a terminal window from your Flutter project directory.
  2. To view your app's settings, select the Runner target in the Xcode navigator.
  3. Verify the most important settings.

In the Identity section of the General tab:

  • Display Name: The display name of your app.
  • Bundle Identifier: The App ID you registered on App Store Connect.

In the Signing & Capabilities tab:

  • Automatically manage signing: Whether Xcode should automatically manage app signing and provisioning. This is set to true by default, which should be sufficient for most apps. For more complex scenarios, see the Code Signing Guide.
  • Team: Select the team associated with your registered Apple Developer account. If required, select Add Account..., then update this setting.

In the Deployment section of the Build Settings tab:

  • iOS Deployment Target: The minimum iOS version that your app supports. Flutter supports iOS 12 and later. If your app or plugins include Objective-C or Swift code that makes use of APIs newer than iOS 12, update this setting to the highest required version.

The General tab of your project settings should resemble the following:

Xcode General Tab Example

##Create an app bundle

Run flutter build ipa to produce an Xcode build archive (.xcarchive file) in your project's build/ios/archive/ directory and an App Store app bundle (.ipa file) in build/ios/ipa.

Consider adding the --obfuscate and --split-debug-info flags to obfuscate your Dart code to make it more difficult to reverse engineer.

If you are not distributing to the App Store, you can optionally choose a different export method by adding the option --export-method ad-hoc, --export-method development or --export-method enterprise.

Note On versions of Flutter where flutter build ipa --export-method is unavailable, open build/ios/archive/MyApp.xcarchive and follow the instructions below to validate and distribute the app from Xcode.

Upload the app bundle to App Store Connect

Once the app bundle is created, upload it to App Store Connect by either:

Install and open the Apple Transport macOS app. Drag and drop the build/ios/ipa/*.ipa app bundle into the app.

Or upload the app bundle from the command line by running:

xcrun altool --upload-app --type ios -f build/ios/ipa/*.ipa --apiKey your_api_key --apiIssuer your_issuer_id content_copy

Run man altool for details about how to authenticate with the App Store Connect API key.

Or open build/ios/archive/MyApp.xcarchive in Xcode.

Click the Validate App button. If any issues are reported, address them and produce another build. You can reuse the same build ID until you upload an archive.

After the archive has been successfully validated, click Distribute App.

Note When you export your app at the end of Distribute App, Xcode will create a directory containing an IPA of your app and an ExportOptions.plist file. You can create new IPAs with the same options without launching Xcode by running flutter build ipa --export-options-plist=path/to/ExportOptions.plist. See xcodebuild -h for details about the keys in this property list.

You can follow the status of your build in the Activities tab of your app's details page on App Store Connect. You should receive an email within 30 minutes notifying you that your build has been validated and is available to release to testers on TestFlight. At this point you can choose whether to release on TestFlight, or go ahead and release your app to the App Store.