Cordova/Phonegap - Android: Icon not updating

10,530

Solution 1

I am using http://ionicframework.com/ to build my app and it uses cordova. I ran into the same issue as you and was able to fix it very easily.

What I suggest first is going to the root of your project and running the following:

grep -nr "icon.png" *

This will list all the references to the icon.png and can give you an idea of where the files are being copied to. I too updated my android/res/drawable folders to no luck. But after running the grep command above I noticed that the icons were being copied into:

/platforms/android/ant-build/res/drawable-xhdpi/icon.png

I navigated to this folder and noticed that the images were the default cordova png images. I updated each drawable with my icons and now all is well.

Hopefully this can help resolve your issue. Best of luck!

Solution 2

A restart worked for me. The device must cache them?

Solution 3

Try simply restarting your phone. It sounds ridiculous, but it fixed the same issue for me.

Solution 4

It seems the www/res/icons aren't really functional, I've seen no indication that they are functional, here is a useful article: http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/

The best thing to do is to write a script once to copy them into the right place

Solution 5

As of Cordova 8.0.0, this still seems to be a problem. I replaced the default cordova icons located in res\icon\android with my own (keeping the file names in tact) and expected that the build would use those icons, but it did not.

The fix for me was to specify the path to the icons explicitly in the platform section of config.xml.

<platform name="android">
    <allow-intent href="market:*" />
    <icon density="ldpi" src="res/icon/android/icon-36-ldpi.png" />
    <icon density="mdpi" src="res/icon/android/icon-48-mdpi.png" />
    <icon density="hdpi" src="res/icon/android/icon-72-hdpi.png" />
    <icon density="xhdpi" src="res/icon/android/icon-96-xhdpi.png" />
</platform>
Share:
10,530
Lucas Lobosque
Author by

Lucas Lobosque

Updated on June 25, 2022

Comments

  • Lucas Lobosque
    Lucas Lobosque almost 2 years

    I'm using cordova 3.3.0 (CLI) and I replaced the icons in the www/res/icons/android folder, as per docs instructions (http://cordova.apache.org/docs/en/3.3.0/config_ref_images.md.html). The problem is, when I build and send the app to my phone (cordova run android), the icon is still the default one, even if I uninstall the app from my phone before installing again. Any advise on how to solve this? Thanks!