The size of APK files has been increasing dramatically in the last few years. There are several causes for this—more libraries have become available to Android developers, more densities have been added, and apps are getting more functionality in general.
It is a good idea to keep APKs as small as possible. Not only because there is a 50 MB limit on APK files in Google Play, but a smaller APK also means that users can download and install an app faster, and it keeps the memory footprint down.
In this section, we will look at a few properties in the Gradle build configuration file that we can manipulate to shrink APK files.
ProGuard is a Java tool that can not only shrink, but also optimize, obfuscate, and preverify your code at compile time. It goes through all the code paths in your app to find code that is not used and deletes it. ProGuard also renames your classes and fields. This process keeps the footprint of the app down, and makes the code more difficult...