I'm trying to reduce the size of my instant apps apks. I managed to divide the main module into several smaller ones (features and libraries). Once the app is built, apk files are sized (with minify enabled): 4.9 MB (base feature), 5 MB (ui feature - activities, fragments, receivers etc) and 1.3MB (item details feature). The problem is that I don't know what else I can cut from modules, because the package that using the most of size is... com.google.android.gms.internal (screens below).
BaseFeature:
UI Feature:
I'm afraid that even if I split those modules more, the problem with this library will still be there. I'm really close to finishing the instant app of my application, but I can't upload those files because of too large size. Can anyone knows how to figure out with this?
Generally, here is what you can do to reduce APK size.
Methods that was in the scope of the documentation.
Reduce resource count and size
One of the simple ways to make your APK smaller is to reduce the number and size of the resources it contains. In particular, you can remove resources that your app no longer uses, and you can use scalable
Drawable
objects in place of image files.
Reduce native and Java code
Maintain multiple lean APKs
Your APK can contain content that users download but never use, like regional or language information. To create a minimal download for your users, you can segment your app into several APKs, differentiated by factors such as screen size or GPU texture support.
Another reference to Shrink Your Code and Resources
To make your APK file as small as possible, you should enable shrinking to remove unused code and resources in your release build. This page describes how to do that and how to specify what code and resources to keep or discard during the build.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With