I have an app with minSdkVersion=21 which now uses an vector drawable as a launcher icon.
Google Play rejects the app with
You need to check the icon inside your APK because it is not valid
since it needs to launcher icons in PNG format.
I would like to generate PNG files for the launcher icon as part of the build process, just as is done if I lower minSdkVersion to 20 (but I cannot do that, since the app is not compatible with 20 or older). Is this possible?
EDIT: To clarify, it works when the minSdkVersion is < 21, as gradle takes care of generating png versions of vector drawables. But when minSdkVersion >= 21, gradle leaves vector drawables as is, which does not work for launcher icons. The question is if it's possible to make gradle build png versions of vector drawables for launcher images even on minSdkVersion >= 21.
It seems Google Play supports vector drawables now (Dec 2017) as launcher icons. I have recently uploaded and published an app with a vector laucher icon.
I don't think that's possible to convert android's vector drawable format(also really similar to SVG) to PNG in building process.
And in your case, you need to convert the vector drawable to SVG by hand, I think that's not hard, then convert that general SVG to PNG(convert cmd in ImageMagick toolkit should be cool).
If you need some cool tool to generate all size sets of launcher icon, use the online web app Android Asset Studio
anyway, I don't think that's a good idea to convert your android vector XML to PNG in building process, also it is possible to do that, you need to write another custom android Gradle plugin which can read the vector drawable XML file and convert it to SVG first maybe, then to your final PNG format. That's a lot of java or Groovy code, and just too complicated for a simple project.
https://developer.android.com/studio/write/image-asset-studio.html#access In Android Studio, it included an image asset edit tool just like above web app, I think we can edit our image asset directly inside the studio now.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With