breautek commented on issue #1666:
URL:
https://github.com/apache/cordova-android/issues/1666#issuecomment-1731542952
> The question is, where should I have the res folder?
in the context of `<icon src="...">` the path is relative to the cordova
project.
A standard cordova project folder will look like...
```
/ - root
/config.xml
/www
/platforms
...
```
So you can create a `res` folder and organise it that way that it makes
sense for you.. e.g. `/res/icons/android/...` and have the icon configured as:
`<icon src="res/icons/android/..." />`
> Also not sure if one png file would be enough?
You're also correct... a single resource isn't enough for Android. While
Android API 21 supports vector icons, which Cordova has support for... Cordova
still assumes that mipmap (rasterized PNGs) are used, in which case you need to
provide a different resolution version for the different density levels, which
are as follows:
|density|resolution|
|---|---|
|mdpi|48x48|
|hdpi|72x72|
|xhdpi|96x96|
|xxhdpi|144x144|
|xxxhdpi|196x196|
There is also a `ldpi` that uses 36x36 image but no device that cordova
supports today uses a low density, so it can be omitted. You specify each icon
using the `"density"` attribute: `<icon src="..." density="mdpi" />`
At minimum this is what you'll need. But there are [optional
settings](https://cordova.apache.org/docs/en/12.x/config_ref/images.html#adaptive-icons)
to support adaptive icons for API 26+ devices, as well as monochrome icons for
API 33+ devices.
Icons can be replaced with an [Android
Vector](https://developer.android.com/develop/ui/views/graphics/vector-drawable-resources)
resources instead of using PNGs but I believe Cordova still expects you to
specify each density.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]