Google’s New Android App Bundle: A Win-Win for Developers and Users

1
239

Android App Bundle is a new app publishing format (.aab), which enables Play Store to publish lean app APKs (Android Package Kits). So developers now need to code less when pushing an app to Play Store, and users benefit by getting a small-sized APK, which helps them save space on the phone. Let’s take a quick look at this new format.

One of the most stressful tasks of an Android developer is managing the distribution of an app, uniformly, on all devices across the globe. There are concerns about resource management, screen density, CPU architecture, language management, etc. In the current scenario, multiple APK files (comprising all types of resources for the app’s target devices), which satisfy all of the app’s requirements, must be developed for it to run flawlessly and efficiently. The price for this is a huge APK size. Figure 1 represents the APK format system.

Google has addressed this issue by introducing the Android App Bundle format. This new upload format is very similar in code to the APK, but differs when you sign in and upload it to Google Play.

Figure 1: APK file with the resources for all devices

The magic of App Bundle happens when a user approaches Play Store to download the application. Google Play analyses the requirements for the user’s phone and only provides the resources needed for the smooth execution of the app on that device. The developer can now relax since there is no longer any need to build multiple APKs to support all devices, while the user benefits by getting a small-sized APK, thereby saving phone storage space and data usage. This is a win-win situation for everyone.

Figure 2 represents the Android App Bundle format. Here the APK is generated by Google Play, with only the required resources for the target device. In this example, language support for English (EN), resources of xhdpi and 64-bit ARM CPU architecture are the only contents of the APK file.

Also, Google allows the developer to add dynamic features and modules to the application using the App Bundle. This means that users can download different modules of an application, as per their needs. So, initially, a base model of the application will be given, after which the user can download and upgrade the additional features, when required.

Figure 2: The App Bundle format – APK is generated with only the required resources
Figure 3: On the left is a simple app with a base APK (B) and some configuration APKs (C). On the right is a more complex app with two dynamic feature APKs (D) and the corresponding configuration APKs (C) for download on demand

How Android App Bundle works

Android delivers the APK with the required resources using what is called the split APK mechanism. This is available for Android Lollipop devices and higher versions. Google Play uses this mechanism to split the large app into a smaller APK, as per the target device’s requirements.

According to Google, there are three types of split APKs —the base APK, the configuration APK and the dynamic feature APK.

  • The base APK contains the basic requirements for the application. This is the mandatory first APK to be installed.
  • The configuration APK includes the specific data, based on the device’s requirements. The configuration APK is generated by Google Play from the App Bundle that is uploaded to the store. It automatically allocates the resources such as CPU architecture, language, etc, from the set of code provided.
  • The dynamic feature APK has the optional features, which can be installed as required by the user.

Figure 3 shows the split APK mechanism — for a basic device and a more resource-specific device. Here, B means ‘Basic APK’, C stands for ‘Configuration APK’, and D for ‘Dynamic feature APK’.

Figure 4: Building bundles
Figure 5: Generate Signed Bundle

Deploying the Android App Bundle

The Android App Bundle is in the Beta stage and, hence, to use the feature, we need to download the Android Studio 3.2 Preview Version. (Warning: This is not a stable version.) After downloading, open Android Studio and import your code. Select the Build menu, and from there, choose Build Bundles to do so.

To upload the bundle to Play Store, select the Generate Signed Bundle/APK(s) option from the Build menu (Figure 5).

Now, select Keystore and provide your credentials. This is similar to APK signing. The final bundle can be found in the .aab format, to upload to Play Store.

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here