Search code examples
androidpngwebp

Converted all drawables to WebP, apk size stayed the same


Very confused. I just converted a lot of drawables in my res folder to the lossless WebP format. As I did it, Android Studio told me I saved 6mb, however I just build an production-release apk, one for the branch with WebP images and one with everything still as PNG, the difference is negligible. The PNG apk size is 23.2MB, the WebP apk size is 21.3.

I ran the apk analyzer tool, and I can see that the big difference is my res folder is now 7MB smaller, yet that wasn't translated to the apk size?

Here is the apk analyzer results, firstly the old apk (PNGs) Left number is uncompressed, right value is compressed, so what goes out to users in the apk:enter image description here

Secondly here is the new apk (WebP): enter image description here

The drawable files are quite clearly smaller, my biggest folder inside res is now 200kb.

Can someone who has played with WebP in Android offer some information on why this didn't work? No other numbers have changed in the apk analyzer.

Edit: Sorry about the small images, view in new tab to see clearer


Solution

  • Solved why it was happened.

    I have shrinkResources set to true on my release builds in my build.gradle, so compression was already taking place.

    Makes a lot of sense, mistake on my part, totally forgot about it.