Android App Bundles

print

About Android App Bundles

An Android App Bundle is a new upload format that includes all your app’s compiled code and resources, but defers APK generation and signing to Google Play.

Google Play’s new app serving model, called Dynamic Delivery, then uses your app bundle to generate and serve optimized APKs for each user’s device configuration, so they download only the code and resources they need to run your app. You no longer have to build, sign, and manage multiple APKs to support different devices, and users get smaller, more optimized downloads.

Additionally, you can add dynamic feature modules to your app project and include them in your app bundle. These modules contain features and assets that you can decide not to include when users first download and install your app.Using the Play Core Library, your app can later request to download those modules as dynamic feature APKs, and, through Dynamic Delivery, Google Play serves only the code and resources for that module to the device.

Watch the following video for an overview of Android App Bundles and Dynamic Delivery.

If you’re using Android Studio 3.2 or higher, most app projects require little effort to support Dynamic Delivery, and you can build an Android App Bundle in just a few clicks. However, adding dynamic feature modules is still in beta, and requires a little more effort and possibly refactoring your app.

 

Get started

To build app bundles and support Dynamic Delivery, follow these steps:

  1. Download Android Studio 3.2 or higher—it’s the easiest way to add dynamic feature modules and build app bundles.
  2. Add support for Dynamic Delivery by including a base module, organizing code and resources for configuration APKs, and, optionally, adding dynamic feature modules.
  3. Build an Android App Bundle.
  4. Test your Android App Bundle using bundletool to generate APKs from your app bundle and deploy them to a connected device.
  5. Enroll into app signing by Google Play. Otherwise, you can’t upload your app bundle to the Play Console.
  6. Upload your app bundle to the Play Console. You can then use the Play Console’s new internal test track to quickly test downloading your app via Dynamic Delivery.

https://developer.android.com/studio/command-line/bundletool

Generate a set of APKs from your app bundle

When bundletool generates APKs from your app bundle, it includes them in a container called an APK set archive, which uses the .apks file extension. To generate an APK set for all device configurations your app supports from your app bundle, use the bundletool build-apks command, as shown below.

bundletool build-apks --bundle=/MyApp/my_app.aab --output=/MyApp/my_app.apks

Note that the command above creates an APK set of unsigned APKs. If you want to deploy the APKs to a device, you need to also include your app’s signing information, as shown in the command below.

bundletool build-apks --bundle=/MyApp/my_app.aab --output=/MyApp/my_app.apks
--ks=/MyApp/keystore.jks
--ks-pass=file:/MyApp/keystore.pwd
--ks-key-alias=MyKeyAlias
--key-pass=file:/MyApp/key.pwd

The table below describes the various flags and options you can set when using the bundletool build-apkscommand in greater detail. Only --bundle and --output are required—all other flags are optional.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.