I am making an android project with AndroidStudio and I have a problem with the physical size of the images that I am using.
Basically I have 15 activities and all of them have different .png
files for their background and their buttons. These pictures are in FullHD(1080x1920). I created different "variations" for each picture using the plugin Android Drawable Importer
which takes a picture and "redraws" it for different screen densities (ldpi, mdpi, hdpi, xhdpi, xxhdpi and xxxhdpi). So far so good.
But doing this I am making for each of my pictures (96 in total) 5 copies. And the total size of the resulting pictures in all the drawable directories is around 100MB which make the .apk
file that big.
So my question is: Is there a way to optimize this size or some other better approach?
I have read Supporting multiple screens article which tells me to do what I am doing, but id doesn't consider the resulting size of the .apk file and respectively the size of the app when it is installed on the phone.
Actually the solution in my case was really easy. I was using .png
files for my background images which took a lot of the space and it wasn't really necessary to do so, because I don't need my backgrounds to be transparent. So I converted the background files to .jpg
and left all my other images for buttons in .png
and the size of the .apk
became 16MB. Which is something like 8-9 times smaller than my inital .apk
.