I know this sounds like a stupid question but I've been researching this in depth and have been unable to find a solution. I've started by following the Phonegap documentation which says:
The default icon must be named icon.png and must reside in the root of your application folder.
<icon src="icon.png" />
I added that line to my config.xml and added my icon to the project root. When I rebuild for android this icon is not used as the application icon.
Continuing on in the documentation it says:
We support all Android resource qualifiers. Commonly used qualifiers refer to device density and language.
<icon src="ldpi.png" gap:platform="android" gap:qualifier="ldpi" />
<icon src="mdpi.png" gap:platform="android" gap:qualifier="mdpi" />
<icon src="hdpi.png" gap:platform="android" gap:qualifier="hdpi" />
<icon src="xhdpi.png" gap:platform="android" gap:qualifier="xhdpi" />
<icon src="xxhdpi.png" gap:platform="android" gap:qualifier="xxhdpi" />
<icon src="fr-xxhdpi.png" gap:platform="android" gap:qualifier="fr-xxhdpi" />
A list of these qualifiers can be viewed on Table-2 here. Note that compound qualifiers (eg. "port-xhdpi") have to be in the same order as viewed on this table.
I added these lines to my config.xml (in the same order) and added the various icons with the appropriate resolutions and still no change in the icon. I also tried deleting the platforms directory, uninstalling the application on my phone, and restarting my phone to see if some sort of caching might be the issue. Still no luck.
At this point I started searching StackOverflow for relevant questions (of which there are many). Recommendations include restarting your phone and doing what I did above using the now deprecated 'density' attribute instead of 'qualifier'. Neither of these worked.
Some other people mentioned copying over the icons manually into the 'platform/android' directory and so I also tried this. I replaced every single PNG with my icon. After doing a build, many of these icons that I carefully replaced had been overwritten by the default icon. It's possible that writing a hook to replace these images after they're overwritten but before they're bundled (this is recommended as a workaround), but is the documentation really just totally wrong and we need to write a custom hook to change the app icon?
What am I missing here? It seems like this should be a fairly basic task that anybody making an app with Phonegap would want to do. There are a lot of people reporting that it's not working and not really any good explanations of why not. Is the documentation wrong or am I just misreading it somehow?