Recently, Google officially announced that starting from August 2021, Google Play will require developers to publish new applications in the Android App Bundle (hereinafter referred to as AAB) format, which will replace APK as the standard Android application publishing format.
The preferred application package for Android has always been the APK. APK is the abbreviation of Android Package, that is, the Android installation package. It is a compressed package file based on the ZIP format, which contains a large number of resources such as application code, pictures, audio, and application signature keys generated by the developer. When making the APK package, it is packaged into an installer file supported by the Android system through the packaging tool provided by the Android SDK. Almost all Android applications are released in this format.
1. Why change from APK to AAB
For a long time, Android's preferred application package is APK, so why does Android change the format of the installation package from APK to AAB? Some people say it was to deal with Hongmeng. In my opinion, this is not the case. The official reason for this is actually a means to reduce the APK size.
As we all know, an APK often contains a large number of resources such as application code, pictures, 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.). But in this case, application developers will bear Too many: Not only to develop apps, but also to manage many APKs to support a large number of devices.
Therefore, in order to save time and effort, most developers will choose to build a universal APK, which includes all resources including language packs, codes, etc. No matter where the user is and what device they use, they only need to download this universal APK, which causes the problem of large APK packages. In order to solve this problem, Google launched the AAB format at the Google I/O Conference in 2018, hoping to reduce the burden on developers, while also helping to reduce application size, installation time and bandwidth consumption, and improve user experience.
Therefore, the AAB format is not actually a brand new application installation package, but a set of software package management solutions. We can regard it as a container that contains a basic APK and multiple APKs for specific configurations. Given this mechanism, many companies have used it to implement plug-in and dynamic distribution functions in the past two years. Refer to the document: Android App Bundle .
Therefore, once a developer chooses to publish an application in the AAB format, Google will generate an optimized APK from it according to the user's device configuration and provide it to the user. For users, such an APK is small in size and fast to install, and it saves trouble for developers: there is no need to manage a large number of APKs for various devices.
The advantages and characteristics of AAB
Compared with the traditional APK method, what are the advantages of AAB? First of all, the application size mentioned above is reduced. According to Google's official introduction, the volume of the optimized APK generated by AAB will be 15% smaller than the average APK, and this data will fluctuate greatly according to the size of the application. For example, Airbnb reduced the application size by 22% after switching from APK to AAB format, while Netflix reduced it by 57%.
Secondly, AAB's Play Feature Delivery function can customize which function modules are delivered to which device, and supports three modes: delivery during installation, delivery on condition and delivery on demand. This is to separate the functions of the application, so as to greatly shorten the time for users to download the application. Users of useless functions may not download them or wait to download them when needed later.
There is also a Play Asset Delivery function, which can dynamically deliver large resources to reduce user waiting time and reduce delivery costs. That is, games using Play Asset Delivery can use texture compression format as a delivery condition, so that users can only obtain resources suitable for their equipment, and avoid wasting space or bandwidth.
How to make an AAB package
Similar to the process of making APK packages, we can also use Android Studio to make AAB packages. First, select the Android Studio toolbar [build] -> [generate singed bundle apk], as shown in the figure below.
Finally, when the packaging is completed, a xxx.aab file will be generated, as shown in the following figure:
AAB to APK
Although it appears from the results that distributing new applications in the AAB format is beneficial to both developers and users, some people are still a little worried about this. For example, some people worry that because AAB cannot be downloaded outside of Google Play, it will have a great impact on third-party app stores such as Amazon 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 applications in third-party stores can manually export the APK version of their applications. The conversion is named as follows:
abb转apk
java -jar 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
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。