Suyash Dubey | Posted on January 25, 2019February 1, 2019 | 2 min Read Android App Bundle: Get started What is Android App Bundle? It is a new publishing format by Google which is a more efficient way to develop and release app. App bundle helps to reduce your app size and deliver features on demand. Earlier, android operating system used android packaging kit (APK) to distribute and install applications on a device. These applications are downloaded by users across the world on various devices. These devices have different configurations and language inputs. To meet all the users demands, the application becomes bulky as all the features are to be downloaded. Android App Bundle is a zip archive with .aab extension. It contains codes and resources for all the devices that the app supports. Google Play handles signing and generation, once it is uploaded for publishing. In app bundle, dynamic delivery is used to generate an optimized APK for users, based on their device configuration. Benefits of .aab The key benefit of android app bundle is that it the developers need to write less code to push the app in Play store. The users save space in their device by saving a small size APK. App bundles can use uncompressed native libraries in android 6.0 and up, that are stored in the APK instead of the users device. This lowers the download size and the size on disk. It serves users with functions they need on demand, instead of installing all the functions at one go. We don’t need to build and publish multiple APKs, therefore, app bundle also simplify the built and release management. How Android App Bundle works Android delivers APKs with the required resources using split APK mechanism. Google Play uses this mechanism to split large apps into smaller APKs, as per the device requirements. According the Google, there are 3 types of APKs: a) Base APK: This is the first mandatory APK to be installed. It contains the basic requirements for the application. This APK contains codes and resources that other split APKs can provide. Only the base APK’s contains full declaration of your app’s services, permissions, platform version providers and dependencies of system features. It is important that all codes and resources included in this module are included in the base APK. b) Configuration APK: It contains specific data, based on the device requirements. Configuration APK is generated by Google Play from the app bundle that is uploaded to the store. Each of these APKs includes native libraries and resources for a specific screen density, CPU architecture or language. When a user downloads the app, their device downloads only the specific APKs for that device. You don’t create separate module for configuration APKs. If you use standard practices to organize alternative, configuration specific resources for your base and dynamic modules, Google Play automatically generates configuration APKs for you. c) Dynamic Feature APK: These are the optional features installed required by the user. Each of these APKs contains code and resources for a feature of your app that is not needed when your app is first installed. Using the play core library, dynamic APKs may be installed on demand after the base APK is installed on the device to provide additional functionality. Android Application Bundle Format An Android App Bundle is a file with .aab extension which you can upload to Google Play to support dynamic delivery. App bundles are signed binaries that organize your apps resources into modules. Each of these modules may be generated as separate APKs. Google Play uses the app bundles to generate various APKs that are served to users. Image Source: https://developer.android.com/guide/app-bundle/ App Bundle’s files and directories: Base/, feature 1/ and feature 2/: Top level folders that contain different modules of your app. The base directory contains base module of the app. The directory for dynamic feature module is given the name specified by the split attribute in the module’s manifest. Bundle-Metadata: Metadata files include complete list of the app’s DEX files and Proguard Mappings. Files in this directory are not packed into the app’s APKs. Module Protocol Buffer files (*.pb): Provides metadata that describe the content of each module to the play store. For example, native.pb and resource.pb describe the code and resources in each module, which is used when Google Play optimizes APKs for different device configurations. Manifest/,DEX/: Unlike APKs, app bundles stores the androidmanifest.xml and DEX files for each module in a separate directory. res/, libs/and assets/: These directories are used in the same ways as APK, except that for an app bundle, they are used by Google Play to package only the files that satisfy the target device configuration. root/: This directory stores files that are later relocated to the root of any APK including corresponding module. How to deploy App Bundle Unlike APKs, App Bundles cannot be installed on a device. It is an uploaded format which contains compiled code and resources in a single build framework. Once we upload out signed app bundle, Google Play builds and signs the apps APKs and serve them to users through dynamic delivery. Testing your app bundle with Google Play Internal Test Track You need to generate signed in app bundle before you can upload your app bundle to the play console. Proceed with these steps to generate a signed app bundle. Select Build then select Generate Signed Bundle/APK from the menu bar. In the Generate Signed Bundle/APK dialogue, select Android app bundle and click on Next. In the Module dropdown menu, select the base module for the app you want to generate app bundle for. Provide information for an existing key and keystore, or create a new. This is the same type of key and keystore information you provide when building a signed APK. I you want Android Studio to also save your signing key as an encrypted file, check the box next to Export encrypted key. To be able to upload your app bundle and take advantage of dynamic delivery, you need to upload this encrypted file to the play console and enrol in app signing by Google Play. Click Next and provide a Destination Folder for your app bundle. Select the Build Type and flavours that you want to generate app bundles for. Click Finish. Now you have generated a signed bundle, you can upload your app bundle to the play console. Testing your .aab file on pCloudy pCloudy supports .aab format and the user can upload the App Bundle instead of “.apk” to test their app on the device cloud. Conclusion Android Application Bundles is a big step forward in the area of application publishing and uploading. It has reduced the size of APK of your application which leads to more download of the application.