webpandroid-asset-studio

Why and how to generate the ic_launcher.webp icons inside mipmap folder


Android Studio used to generate PNG files for the launcher icons but with the last version, when you create a new project, the default launcher icons inside the mipmap folders are in WEBP format.

I tried to find anything about it but this change is not addressed anywhere. The thing is that if you try to add a new image asset and replace these icons, the generator will create PNG files and you'll have to manually delete the WEBP files.

So, what should one do? Does the Asset Studio have an option for exporting them as WEBP? Is WEBP actually better than PNG (specially for older devices, say API level 21)?


Solution

  • webp is smaller in file size but requires Android 4.3 (API 18)+ for foreground transparency.

    At the moment, you still need to manually convert those generated png icons into webp. Android Studio has built-in support for this conversion.

    Alternatively, you can use Google's command line tool:

    1. get the encoder: https://developers.google.com/speed/webp/docs/precompiled (see "downloads repository")
    2. convert icons: ./bin/cwebp ./ic_launcher.png -q 100 -o ./ic_launcher.webp