To publish an app on Google play, your app APK must be less than 100MB. Recently I’m reading up on the various blogs and documentations to learn their best practices. I’m sharing with you a compilation of these helpful resources for reducing your Android APK sizes. If you are just starting out with Android development, it’s also helpful to learn what exactly is an APK (Android Application package file).

Getting Santa Tracker Into Shape

Google Developer Blog recently (March 1, 2017) published a story on Getting Santa Tracker Into Shape. Here is a summary of their tips:

Enable multiple APK splits with build.gradle when including native library

Run zopfli tool on PNG assets to reduce image sizes

Remove unused resources — In Android Studio click Analyze > Run Inspection by Name > Unused Resources to identify un resources

Image loading backoff — catch out of memory error and reload images with a higher sampling ratio

Wojtek Kalicinski’s blog

Wojtek Kalicinski, Android Devleoper Advocate at Google, recently wrote about how to use the open source tool APK pack size estimator to track app update sizes.

He wrote an eight part blog on reducing APK sizes in 2016 and I’m including the links to each of them below:

Part 1 explains the anatomy of an Android APK

Part 2 explains how to minify Android code

Part 3 explains how to remove unused resources

Part 4 explains how to create multiple APKs through Application Binary Interface (ABI) and density splits

Part 5 explains how to create multiple APKs through product flavor

Part 6 explains how to optimize image in particular Zopfli & WebP

Part 7 explains how to optimize image with ShapeDrawable and VectorDrawables

Part 8 explains how to reduce APK size on projects with native libraries

Lisa Ray’s blog — A smaller, sleeker app using the APK Analyzer

This blog was written in June 2016 and was about how the genius app reduced its APK size by using the APK analyzer to identify the root cause of the large APK size. It caused by 3rd party libraries containing native libraries with multiple architectures all packaged together. Read it here to see how they handled it.

Cyril Mottier’s blog — Putting your apks on diet

This blog was from 2014 but it still contains a lot of relevant great tips. He explained what is inside of an APK, and tips / tricks on how to reduce APK size on the three components: Java source code, resource files and native libraries.

Official Android Developer documentation

Official documentation on how to reduce APK size

https://developer.android.com/topic/performance/reduce-apk-size.html

Analyze your build with APK analyzer

Do you know that you can just drag an APK into the Editor window of Android Studio to analyze it? You can also use Compare With to compare APK sizes between releases.