How to change Cordova application icon?

The answer may vary based on your version of Cordova, but as of Cordova 3.5.0, this is the way of adding icons to your project. As mentioned in my comment, see the official docs for the source.

First create a folder for your icons to live. This will vary depending on your platform, since we are dealing with Android in your case, an assets folder will do nicely. It is easiest to create this in the project root (i.e. with the www/ hooks/ folders, config.xml file etc.)

While this won't impact you, it might be good to note. There is a small BlackBerry quirk regarding icons and splash screens. For BB10 you must place your assets folder in the www/ directory.

Drop your icons in there and add something along these lines to your config.xml file, where the pngs correspond to your icons:

<platform name="android">    
    <icon src="assets/mdpi.png" density="mdpi" />
    <icon src="assets/ldpi.png" density="ldpi" />
    <icon src="assets/hdpi.png" density="hdpi" />
    <icon src="assets/xdpi.png" density="xhdpi" />
    <icon src="assets/xxdpi.png" density="xxhdpi" />
</platform>

Lastly, you can verify these worked after your build by checking the platforms\android\res\drawable- folders. They will contain an icon.png file that was copied across from your source directory during the build.


Add a folder res in app and create folder in it icons/android and save images there

<platform name="android">
    <icon src="res/icons/android/icon-36-ldpi.png" density="ldpi"/>
    <icon src="res/icons/android/icon-48-mdpi.png" density="mdpi"/>
    <icon src="res/icons/android/icon-72-hdpi.png" density="hdpi"/>
    <icon src="res/icons/android/icon-96-xhdpi.png" density="xhdpi"/>
</platform>

Tags:

Cordova