How to Make Your APK Smaller – Tips on Reducing App Size
How to Reduce App Size Most users dislike large apps because they consume space, memory and battery power more quickly while being slower to download. Furthermore, the larger an application becomes, the less likely it will be downloaded and utilized; therefore it is essential that Android App Developers strive to keep its size down as much as possible.
Reducing the size of an APK begins by eliminating unnecessary libraries and dependencies, as these extra files often contribute to its large size. Only include libraries and dependencies necessary for its functionality before using compression techniques on image and audio assets to reduce their size without compromising quality.
Android Lint can assist in this endeavor by helping identify unnecessary scripts and classes and then remove them, thus dramatically decreasing app size. After doing this, it’s crucial that the app be tested thoroughly as otherwise, it could malfunction properly.
Reduce APK size further by decreasing the number of images included within it, which will save both storage space and memory usage on your device. You could use an image compression program such as Photoshop to reduce their size further.
Additionally, to reduce file sizes of both Java and native code applications, consider leveraging smaller libraries with fewer methods and classes, eliminating any unused source files in APKs, and making use of vector drawables to reduce image file sizes; they can scale to any resolution more efficiently than their rasterized counterparts.
Avoid importing too many image variants; this will save a great deal of space in your APK. For instance, avoid including tinted, shaded or rotated versions of the same image when possible; these variants can instead be rendered at runtime via android:tintMode attributes.
Remove any unnecessary PNG and JPG images from the APK, while decreasing image resolution and bitrate of audio files present.
Consider supporting different screen densities when designing an APK. If your survey shows that only a relatively small portion of users have devices with specific screen densities, Android will automatically scale existing resources originally intended for other screen densities and scale them as necessary.