Search code examples
androidfilesizespace-efficiency

How to reduce Android app size by compressing images?


I am developing an Android app which has hundreds of .jpg files (over 300) each one of around 40kB. I would like to know if there is a way of reducing the size of my app. I looked at a similar question here Reducing Android App Size, but the problem still exists. Is there perhaps a way to compress the images and decompress them in real time when needed, or any other way to make my app more space efficient while not sacrificing speed?


Solution

  • If you have used tinypng for every resource you did your best with this kind of solution. In general, it's better to use vector graphics where the general icon will be <1kb. Also, a vector resource can be animated. If it's quite simply bitmaps, you can generate them in code on demand. Also, you can divide your app by dynamic features and each will be downloaded on demand with their part of the resources.

    Is there perhaps a way to compress the images and decompress them in real-time when needed?

    There is no standard Android solution out of the box. Probably, you can write something on your own. But this looks like too much effort.

    Still, the most practical solution: use vector graphics as max as possible, generate in code what you can generate, compress with tinypng the others. That should be enough or you should have a very good reason for making some extra work.

    For more info about vector graphics in android. For standard vector graphic import right in the android studio. Web-site where you can download icons and insert them into the project.