Reducing App size with Android App Bundle

Akhil Handa
3 min readMay 10, 2019

--

At PayNearby, we’re constantly looking for ways to improve the app’s performance, experience and app size so we can deliver a fast & seamless experience to our users. Today, I want to share how we went about reducing the APK size by ~38% with the help of Android App Bundle.

What is APK?
APK is Android package file that contains all the files required by an Android application.

Why App Bundles (.aab) are smaller than the APKs(.apk)

To understand this we first need to understand what an APK is made up of.
In general an APK contains classes.dex files, resources , libraries, assets, resources.arsc, AndroidManifest.xml etc. The major size is occupied by res & resources.arsc (Strings & Dimens).

Picture credits: Google

A good way of reducing APK size is by having multi-APK splits by density, ABIs(architecture) or both, which is available in Google’s official documentation. While this is helpful in reducing the size, it comes with its own caveats.
1. Managing multiple versions for the same app but for different devices.
2. As in Android the drawables have a fallback search i.e. if a drawable is not available in the appropriate dpi of the device it will check in the lower dpi. but with multiple APKs will not have any fallback drawables as they are generated for specific dpis & architecture.
3. Multiple app versions require multiple checks in Fabric Crashlytics, Firebase and backend systems

How App Bundle helps?
Android App Bundle is a new upload format (.aab) which includes all app’s compiled code and resources. Basically, it is a single comprehensive build artefact replacing an APK, but defers APK generation and signing to Google Play.

Play Store uses ‘Dynamic Delivery’, a way to generate and serve optimised APKs for each user’s device configuration from the app bundle, so that only the code and resources needed to run the app are downloaded.

This means developers no longer have to build, sign and manage multiple APKs to support different devices and the best part? App users get smaller, more size-optimised downloads.

Results!
By using Android App Bundle & Google Play Store , it will automatically figure out the best combination of APK split to be downloaded for the end user’s device and take care of your APK splits. The end result is

  • Easy APK split management
  • Hassle-free version code management
  • Smaller APK size than by multi-APK method
App size After App Bundle

--

--