From APK to App Bundle

In May 2018, during Google I/O, Google announced a new app publishing format for the Play Store: the Android App Bundle. It is “a more efficient way to build and release your app”.

When a user installs your app, the Play Store will, on-the-fly, convert the Android App Bundle to an APK which contains resources optimized for the user’s device. Depending on the contents of your app, this might result in a serious reduction in APK size. Smaller APKs are faster to install and use less space on the user’s device.

Google lists size savings ranging from 11% to 56%. But not all apps are created equal, so not all apps will benefit as much from using the new App Bundle format. The biggest gains can be made when your app contains large images for multiple densities (from ldpi to xxxhdpi) or native C/C++ code for multiple processor architectures (armeabi-v7a, arm64-v8a, x86, x86_64,…).

Let’s take a look at some numbers from a project where we recently switched to an App Bundle.

The app

The original version of the POM app contained very few images in different densities but it did include PhotoPay, a commercial SDK by Microblink to scan invoices and identity cards. This SDK contains native code for 4 different processor architectures.

The original APK size was 27MB.

The rewrite

In the new version of the app, the goal was to replace the commercial PhotoPay SDK by a combination of 2 open source SDKs: OpenCV and Tesseract. Especially the OpenCV library is gigantic. It adds several megabytes of native code to your app: from 6MB for armeabi-v7a to 30MB(!) for x86_64.

After refactoring all the code, the resulting universal APK had more than tripled in size to a whopping 90MB.

Our users were not going to be happy…

App Bundle to the rescue

Fortunately an App Bundle is a perfect solution for this type of app. There really is no need to install the native code for 4 different processor architectures on every device.

After configuring support for an App Bundle, using these instructions, the APK size of the POM app shrunk drastically. Depending on the processor architecture the resulting APK was one third to one sixth of the universal APK.

Chart with APK sizes

Version APK Size
Original Universal 27MB
Rewrite Universal 90MB
Rewrite armeabi-v7a 14MB
Rewrite arm64-v8a 16MB
Rewrite x86 25MB
Rewrite x86_64 34MB

Conclusion

You should certainly consider distributing your app as an App Bundle. Especially apps with native code benefit from the on-the-fly stripping of unnecessary resources by the Play Store.

Updated: