8

I am trying to launch a cordova application using phonegap and cannot change the default app icon for iOS - (the actual icons not the splash screen). The default icons are always being copied into the Resouces --> icons folder and not my custom icons. I have used the specified methods from phonegap which suggest adding an icon tag into the config.xml file but this does not work? Restarting xcode and rebooting my app, and deleting it from the simulator/device dont work.

This is my config.xml file where i am specifing the icons...

...
<icon src="icon.png" />
<icon src="icon/ios/icon.png" gap:platform="ios" width="57" height="57" />
<icon src="icon/ios/icon@2x.png" gap:platform="ios" width="114" height="114" />
<icon src="icon/ios/icon-72.png" gap:platform="ios" width="72" height="72"/>
<!-- retina iPad support: PhoneGap 2.5.0+ only -->
<icon src="icon/ios/icon-72@2x.png" gap:platform="ios" width="144" height="144"/>
...

Any help would be amazing!

p.s. i have obviously checked all related posts i could find on this and no luck

cowley05
  • 123
  • 1
  • 1
  • 10
  • Check my very complete icon FAQ for Cordova 5.1.1 here: must read because many things don't work as expected! http://stackoverflow.com/a/31674547/82609 – Sebastien Lorber Jul 28 '15 at 11:19

8 Answers8

5

I have faced the same problem, and despite searching for a definitive I had no luck trying to add the icon tags in the config.xml, neither by storing my icons on the www/icon folder so cordova build could copy them as probably expected. The documentation is not clear at all, scattered around different posts and solutions.

So what works for me is the following, although I think is not the most elegant solution but it works.

Open your XCode project and store your icons on the folder Resources/icons or alternatively select your target project, go to Summary and scroll down until seeing the icons, click on any of them and right click on it and select open in finder so you have the correct location to override the default ones.

Be sure to use the same names that are used in the target folder to avoid confusion and CLEAN your project and BUILD it again.

It is likely that if you Run the project in the simulator or device the default icon appear, in that case just uninstall your app from the device and build it again.

Hope it helps, however I would expect to have instead a method to modify the development www and let cordova build copy the icons and splashcreen.

VicM
  • 2,449
  • 1
  • 18
  • 20
4

I've had the same issue (icon changed back to the default one, even when I had my paths set correctly), changing the line

<preference name="prerendered-icon" value="true" />

in config.xml from true to false solved the problem for me.

ViktorE
  • 51
  • 4
3

This method works but you need the full path including www. <icon src="www/img/logo.png" />

This method was how i thought it should work but it didn't. <icon src="img/logo.png" />

cordova version 4.0.0

Oliver
  • 99
  • 4
  • Yes this path is relative to the root, and not relative to `www` so it must include `www` in the path (if needed). But it only works fine for iOS and not Android see my FAQ here http://stackoverflow.com/a/31674547/82609 – Sebastien Lorber Jul 28 '15 at 12:36
  • This worked for me. I had to add www/icon.png. Thanks – Tony Jan 24 '16 at 16:35
0

It's an open issue: https://issues.apache.org/jira/browse/CB-2606 Sadly that's not the only thing not working with cordova atm...

But you could use this hook (which was linked to the issue) to get the functionality right away: https://gist.github.com/apla/6179863

meaku
  • 897
  • 1
  • 9
  • 14
0

I think you should use the latest version of the phonegap and then give a try.

http://cordova.apache.org/docs/en/3.2.0/config_ref_images.md.html By this we have to not hard code anything in platforms folder of the project.

0

My Cordova version is 3.5.0-0.2.7.
It works but it requires set of icons. I'm testing with Andoid. Reference (Document) here

<icon src="www/res/icon.png" />
<platform name="android">
    <icon src="www/res/android/ldpi.png" density="ldpi" />
    <icon src="www/res/android/mdpi.png" density="mdpi" />
    <icon src="www/res/android/hdpi.png" density="hdpi" />
    <icon src="www/res/android/xhdpi.png" density="xhdpi" />
</platform>

I put those icons in to res folder which is located in /www folder.

Now, for your IOS. It should be the similar. (I cannot confirm. I have no IOS SDK.)

<icon src="www/res/icon.png" />
<platform name="ios">
    <icon src="www/res/ios/icon-60.png" width="60" height="60" />
    <icon src="www/res/ios/icon-60@2x.png" width="120" height="120" />
    <!-- and more.. (please follow the reference)-->
</platform>

Uninstall your app in emulator, or device and try again.
I hope this help. Good luck.

vee
  • 4,506
  • 5
  • 44
  • 81
  • The icon without density is ignored for Android. The icon without height/width may override the other icons for iOS, and order of declaration matters. See my FAQ here http://stackoverflow.com/a/31674547/82609 – Sebastien Lorber Jul 28 '15 at 12:37
0

Using the Hook from this website does the trick for me. This Hook is just a JavaScript which is executed during (time of execution can be configured) the build process. This is a great way to keep the content in the platforms/android directory generic and no modification of configuration files is needed.

PS: Use simple console.log() commands in the Hook in order to see what exactly is done during the build (in the CLI).

honk
  • 9,137
  • 11
  • 75
  • 83
walt
  • 101
  • 5
0

My Cordova version is 4.2. However I am testing in Android.

During build, phonegap copies the icons from the www/res/icons/ios folder into the ant-build's android res folder, so the custom icons are never used and always replaced by the default.

I suggest performing a cordova build --verbose and thoroughly going through the console log and see if it's misbehaving in anyway.

Good luck!

Elixander Chen
  • 119
  • 1
  • 6