Google Play will require developers to publish their apps in the Android App Bundle (AAB) format starting in August 2021. The AAB format will replace APK as the standard Android App publishing format.

The preferred application package for Android has long been APK. APK is the abbreviation of Android Package, namely Android Installation Package. APK is a ZIP format based compressed Package file, which contains a large number of resources such as application code, pictures, audio and application signature keys generated by the developer. When the APK package is made, it is packaged into an Android-supported installer file using the packaging tools provided by the Android SDK. Almost all Android applications are distributed in this format.

1. Why change from APK to AAB

The preferred application package for Android has always been APK, so why did Android change the package format from APK to AAB? Some say it is to deal with Hongmeng. In my opinion, this is not the case. The official reason for doing this is actually a means to reduce the size of APK.

It is well known that an APK often contains a lot of resources such as application code, images, audio, and application signature keys generated by the developer. Not only that, in order to be compatible with more devices, an APK also needs to adapt to different screen densities (320dpi, 480dpi, etc.), processors (ARM, ARM64, x86, etc.). In this case, however, the application developer is overwhelmed: not only developing the application, but also managing many APKs to support a large number of devices.

Therefore, to save time and effort, most developers choose to build a universal APK that contains all the resources, including language packs, code, and so on. No matter where you are and what size of device you are using, you just need to download the universal APK, which leads to the problem of large APK packages. To address this issue, Google introduced the AAB format at Google I/O 2018, hoping to reduce the burden on developers while also helping to reduce application size, installation time, and bandwidth consumption and improve the user experience.

So, the AAB format is not a new application package, but rather a package management solution for software, which we can think of as a container containing a basic APK and multiple APKs for a specific configuration. Given this mechanism, many companies have used it to implement plug-in and dynamic delivery in the last two years, see the documentation: Android App Bundle.

Therefore, once a developer chooses to publish an application in the AAB format, Google generates an optimized APK from the app based on the user’s device configuration. This makes APKs smaller and faster to install for users, and easier for developers: you don’t have to manage a lot of APKs for different devices.

Advantages and characteristics of AAB

What are the advantages of AAB over traditional APK? The first is the aforementioned downsizing of apps. According to Google, the optimized APK generated using AAB is on average 15% smaller than the normal APK, and this figure can vary widely depending on the size of the application. Airbnb, for example, saw its app size decrease by 22% after switching from APK to AAB, while Netflix saw its app size decrease by 57%.

Secondly, the Play Feature Delivery function of AAB can customize which functional modules will be delivered to which device, supporting three modes of Delivery on installation, Delivery on condition and Delivery on demand. The idea is to split up the app’s features, which can dramatically reduce the time users take to download the app. Users can skip the features they don’t need or wait until they need them later.

There is also a Play Asset Delivery feature that dynamically delivers large resources to reduce user wait times while reducing Delivery costs. Games using Play Asset Delivery can be delivered in a texture-compressed format so that users only get the resources appropriate for their device and avoid wasting space or bandwidth.

How do I pack an AAB bag

As with the APK package production process, we can also use Android Studio for the AAB package production. First, select the Android Studio toolbar [Build] -> [Generate Singed Bundle APK], as shown below.

Finally, when the packaging is completed, a file of XXX. AAB will be generated, as shown in the following figure:

AAB turn APK

While it turns out that distributing new apps in the AAB format is good for both developers and users, there are some concerns. For example, there are concerns that AAB, which cannot be downloaded outside of Google Play, will have a big impact on third-party app stores such as Amazon’s App Store. To this end, Google has developed an open source tool called BundleTool that allows developers to create APKs from AAB packages, so developers who want to publish Android apps in third-party stores can manually export the APK version of their app. The name of the transformation is as follows:

Jar build-apks --bundle=app.aab --output= finalApp.apks --ks=onlinetv.jks -- bundleTool-all-1.7.0.jar build-apks --bundle=app.aab --output= finalApp.apks --ks=onlinetv.jks --ks-pass=pass:123456 --ks-key-alias=onlinetv --key-pass=pass:123456 -- java-jar BundleTool-all-1.7.0.jar install-apks --apks=finalapp.apks