Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cordova/Phonegap - Android: Icon not updating

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!

like image 483
Lucas Lobosque Avatar asked Feb 08 '14 14:02

Lucas Lobosque


5 Answers

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!

like image 63
Makeen A. Sabree Avatar answered Nov 18 '22 07:11

Makeen A. Sabree


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

like image 31
Kristian Ivanov Avatar answered Nov 18 '22 07:11

Kristian Ivanov


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

like image 35
Adam Maloney Avatar answered Nov 18 '22 08:11

Adam Maloney


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

like image 2
Kaan Soral Avatar answered Nov 18 '22 09:11

Kaan Soral


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>
like image 1
Chris Hubbard Avatar answered Nov 18 '22 08:11

Chris Hubbard