Shrinking Your App

You might think that the app that you create is the smallest that it could be, by default. After all, why would a build process put extra stuff in your app that you are not using?

Unfortunately, that’s exactly what happens.

As a result, the APK file that you get from the build process, or from signing your app, may be larger than is necessary. In some cases, this is not a big problem. In other cases, though, it may be more of an issue.

So, in this chapter, we will explore what you can do to reduce the size of your APK.

Why We Care

Your users may care about how much it costs to download your app, if they use a metered data connection and pay by the MB.

Your users may care about how much on-disk space your app consumes, if their device is short on available space. Note, though, that the amount of disk space that your app consumes is only partly from the APK — it also comes from any content that you store locally from within your app, such as in Room databases.

You may care more directly, in that your chosen app distribution channels may impose limits on the APK size. Google’s Play Store, for example, has a 100MB limit on the size of an APK.


Prev Table of Contents Next

This book is licensed under the Creative Commons Attribution-ShareAlike 4.0 International license.