Fit the bill.
Take care of the KBs and the MBs will take care of themselves.
To reduce the app size let’s try to understand more about the app size at various stages and what the app actually contains as it is shipped to the user.
We should look at the .apk size (download/update) and the install size.
What’s in an .apk ?
1. Code (Dex files and Native code)
2. Resources (Layouts,Drawables,Styles,Themes etc.)
3. Miscellaneous (Assets,Manifest files etc)
How to reduce the app size?
1. USE PROGUARD
1.1 It reduces the application size by shrinking your code.
1.2 It Improves performance.(By constant propagation,method inlining , class merging , Removing logging code etc)
1.3 It protects the app by renaming classes,fields and methods with semantically obscure names the makes reverse engineering harder.
1.4 Proguard is available out of the box in Android studio, just set minifyEnabled true, in the gradle file of the main module.
1.2 The proguard-android.txt, contains a few entries by default. When you add new libraries to your project the usually come with a set of proguard instructions, you just need to keep copying them into your proguard-android.txt file as you go along.
1.3 Since proguard obfuscates the app code, the stacktraces are not readable. Whenever you build your project a mappings.txt file is generated at ‘build/outputs/proguard/release/mapping.txt in your application module’s directory.’
1.4 Keep this file mapped with each of the releases, you can upload it to Play console , and the stacktraces would be deobfuscated by google automagically!!
1.5 If you do minifyEnabled true, another feature to reduce your app size is unlocked.. shrinkResources true and done!
Libraries that you add to your code may include unused resources. Gradle can automatically remove resources on your behalf if you enable
shrinkResources in your app's
2.1 Use Vector Drawables and Shape drawables for all the icons,background images gradients etc. needed for the app UI. this would reduce another huge chunk in the app size. These are readily available, customizable (Color/Size) and easy to maintain than PNG/JPEG files for different resolutions.
2.2 Even if you do have to use image files compress them using tools like pngcrush, pngquant, or zopflipng.
2.3 You can also use WebP file format which provides better compression than both JPEG or PNG and hence reduces the file size
3. Use downloadable fonts.
3.1 If you are using custom fonts in your app and have the font files in your assets folder then theres a good news for you. Soon you could start using downloadable fonts so that you don’t have to ship them with your apk. Multiple apps can share the same font from the same cache optimizing the overall usage for the user. This feature is in beta you can start trying it out with Android Studio 3.0 canary build.This would save some precious KBs … :)
4. Use Google certificate Signing.
4.1 Google announced a Google Play App Signing, a new cloud-based service that fine-tunes apps for a range of Android devices.
4.2 Google Play App Signing, automatically adapts apps to fit different screen resolutions, RAM configurations, and processor models and it compresses apps by eliminating redundant code.
I am pretty sure, that if any regular app is put through such rigorous size reduction regime it would come out all slim and trim.
5. Further reading and references.