James Montemagno
James Montemagno

Live, Love, Bike, and Code.

Live, Love, Bike, and Code



Shrink Your Android App Size with One Setting

When you are developing Android apps your app size can grow really fast.  We can get so caught up in the day to day that we forget how important it is to keep down the app size of our app. It may not seem like a 20MB APK is that much, but when you have limited internet or reception it can be a real pain.

As an Android developer you have to develop for multiple ABIs, add a ton of resources and translations, and of course you have you have all of your source code and dependencies. You may have a lot of other settings turned on in your app such as startup tracing, AOT, and obfuscation and this can all lead to larger sizes. But do not fear because App Bundles are here to save you!

Hopefully this is not new to you, but if it is, well you are in for a treat because Android App Bundles solves a bunch of issues when it comes to packaging APKs. When you use App Bundles you package up your app into a special format and Google Play will then optimize your app for your users on demand. What does this mean? It means that with one tiny little setting your app is greatly reduced in size.

I just launched Island Tracker for Animal Crossing and it was my first app that I published with App Bundles and my mind was blown away. When I package up my APK by itself I package for both arm64-v8a & armeabi-v7a. I also use a lot of packages including Sharpnado, Syncfusion, App Center, Xamarin.Forms, Xamarin.Essentials, PancakeView, and more. I also have turned on startup tracing, so for all of that my app is around 30MB as an APK.

When I toggle on App Bundles and submit it to Google Play.... 12.1-12.5MB!!!!!!! That is a reduction of 67%!

That is a crazy reduction and it took me all of 10 seconds to enable because I am using App Center to build my app. When you setup your configuration, simply turn on "Build an App Bundle":

Just like that you are good to go! You of course you can do this manually and publish it or even turn it on in other CI services, but you need to do this ASAP if you ever thought your app was to big.

Copyright © James Montemagno 2020 All rights reserved. Privacy Policy

View Comments