Android App bundle(.aab)
A new app publishing format is available in 3.2 version to deploy customized apk to users using Google play’s dynamic delivery system.Studio will generate .aab file that will be uploaded on playstore and it will create many different versions of app based on chip architecture, screen size and locale. Newer customized apk for different devices have smaller download size.(We can still do these things using app split and some configuration changes in gradle, but now play console and studio will do these task automatically for you).
App bundle is a publishing format it can’t be directly install on device.It also contains some metadata files that will not be present in final apk;
It will also enable dynamic feature to be included in app for specific devices using on demand installation.
Android App bundle will enable two feature in android app development.
- Dynamic delivery system
- Modular App development
In this article we will discuss about dynamic delivery system only.
Before discussing These feature first we will discuss what is inside .aab zip archive.
What is inside .aab-
.aab archive file structure is similar to apk file.There is manifest folder having Android Manifest.xml file in the apk it is in binary format but in .aab it is real XML file compiled into a protocol buffer format because this allows to transform it easily. Dex files are under directory named dex. res,assets and native libs directory structure is same as in apk but XML resources are compiled into protocol buffers instead of binary format.
resources.pb(protocol buffer format) is resource table file equivalent of resources.arac in apk. assets.pb and native.pb are equivalent of resource table for assets and native library.
resource table ,asset table and native libraries table describe the targeting of the files of your app.File targeting is the description of what type of device or user a given file is targeted for.Play console use these tables to create multiple customized apk.
Assets targeting- app bundle also allows assets targeting, currently only Language targeting is supported.Texture compression and Graphic Api version for openGL will also be added in future.
Example- How to use assets targeting in below pic.
Dynamic Delivery System-
A fundamental component of Dynamic Delivery is the split APK mechanism available on Android 5.0 (API level 21) and higher. Split APKs are very similar to regular APKs — they include compiled DEX bytecode, resources, and an Android manifest. However, the Android platform is able to treat multiple installed split APKs as a single app. With split APKs, Google Play can break up a large app into smaller, discrete packages that are installed on a user’s device as required.
The following describes the three kinds of split APKs, and figure 1 below illustrates the relationship of these APKs for a simple and more complex app.
- Base APK: This APK contains code and resources that all other split APKs can access and provides the basic functionality for your app. This is the first APK that’s installed when a user downloads your app.
- Configuration APKs: Each of these APKs include native libraries and resources for a specific screen density, CPU architecture, or language. That way, when a device downloads a base or dynamic feature APK, it downloads only the libraries and resources it needs. For most app projects, you don’t need to refactor your app to support configuration APKs, Google Play generates them for you from the code and resources you include in your app bundle.
- Dynamic feature APKs: Each of these APKs contain code and resources that are not required when your app is first installed, but may be downloaded and installed later.
Size savings by Dynamic delivery system-
On an average app published with app bundles are 20% smaller in size.
App having multiple language supports and native libraries will get maximum advantage from this.
Note: If Every app switch to app bundle we are going to save 10PB data per day from app downloads and upgrade.
How to build app bundle-
To make app bundle in Android studio 3.2 inside build menu tab and additional build bundle menu item is available.We can configure bundle file.
That’s all about dynamic delivery using android app bundle.So let’s wait for Android studio 3.2 and save user data(both device data and network data).
Checkout following articles about android development.
Android Runtime (ART) is an application runtime environment used by the Android operating system. Replacing Dalvik, the…medium.com