Open desmeit opened 5 years ago
It is reason why icon is not working.
I am also facing the same problem. Is there any solution ?
The reason is the icons are now named ic_launcher.png. You can fork repo and rename, or make pull request. I have the same problem and I forked repo and changed the name and it works.
@przem93 I tried that and it still doesnt work for me. Neither cordova-icon nor cordova-splash after upgrade from Android 7.1.4 to 8.1.
I have tried editing the cordova-icon index.js to produce images with the name ic_launcher.png: iconsPath : 'platforms/android/app/src/main/res/', icons : [ { name : 'drawable/ic_launcher.png', size : 96 }, { name : 'drawable-hdpi/ic_launcher.png', size : 72 }, { name : 'drawable-ldpi/ic_launcher.png', size : 36 }, ....
I have also tried changing the path of the icons to be created at iconsPath : 'platforms/android/res' which was suggested as a fix for cordova-splash but this also didnt work. I am currently still getting only the standard cordova icon and no splash screen on cordova 8.1.2 and android 8.1.
Any suggestions ?
Its my code
platforms.push({ name : 'android', isAdded : fs.existsSync('platforms/android'), iconsPath : 'platforms/android/app/src/main/res/', icons : [ { name : 'drawable/ic_launcher.png', size : 96 }, { name : 'drawable-hdpi/ic_launcher.png', size : 72 }, { name : 'drawable-ldpi/ic_launcher.png', size : 36 }, { name : 'drawable-mdpi/ic_launcher.png', size : 48 }, { name : 'drawable-xhdpi/ic_launcher.png', size : 96 }, { name : 'drawable-xxhdpi/ic_launcher.png', size : 144 }, { name : 'drawable-xxxhdpi/ic_launcher.png', size : 192 }, { name : 'mipmap-hdpi/ic_launcher.png', size : 72 }, { name : 'mipmap-ldpi/ic_launcher.png', size : 36 }, { name : 'mipmap-mdpi/ic_launcher.png', size : 48 }, { name : 'mipmap-xhdpi/ic_launcher.png', size : 96 }, { name : 'mipmap-xxhdpi/ic_launcher.png', size : 144 }, { name : 'mipmap-xxxhdpi/ic_launcher.png', size : 192 } ] });
Check if icons are generated and are in location.
It is stupid question, but are you sure that modified code is invoked ?
Thanks for your quick response @przem93 !! So for me the icons were getting generated correctly with the changed name and everything but I was still seeing the native cordova icon in the end. The problem appears to be that the android platform 8.1 adds another folder called mipmap-hdpi-v26 containing the ic_launcher_foreground which the plugin does not overwrite. Deleting those folders seems to fix the problem for me and the app gets the correct icon. Now i need to figure out what the splash screen problem is with cordova-splash.
Here is what I did to fix this. Remove installed old cordova-icon (global), clone my fork of this reprository and make it executable and run it:
sudo npm -g remove cordova-icon
git clone git@github.com:kw-pr/cordova-icon.git
chmod +x cordova-icon/bin/cordova-icon
./cordova-icon/bin/cordova-icon --config=www/config.xml
I changed android platform in cordova-icon/index.js:69
to:
platforms.push({
name : 'android',
isAdded : fs.existsSync('platforms/android'),
iconsPath : 'platforms/android/app/src/main/res/',
icons : [
{ name : 'drawable/ic_launcher.png', size : 96 },
{ name : 'drawable-hdpi/ic_launcher.png', size : 72 },
{ name : 'drawable-ldpi/ic_launcher.png', size : 36 },
{ name : 'drawable-mdpi/ic_launcher.png', size : 48 },
{ name : 'drawable-xhdpi/ic_launcher.png', size : 96 },
{ name : 'drawable-xxhdpi/ic_launcher.png', size : 144 },
{ name : 'drawable-xxxhdpi/ic_launcher.png', size : 192 },
{ name : 'mipmap-hdpi/ic_launcher.png', size : 72 },
{ name : 'mipmap-hdpi-v26/ic_launcher_foreground.png', size : 72 },
{ name : 'mipmap-ldpi/ic_launcher.png', size : 36 },
{ name : 'mipmap-ldpi-v26/ic_launcher_foreground.png', size : 36 },
{ name : 'mipmap-mdpi/ic_launcher.png', size : 48 },
{ name : 'mipmap-mdpi-v26/ic_launcher_foreground.png', size : 48 },
{ name : 'mipmap-xhdpi/ic_launcher.png', size : 96 },
{ name : 'mipmap-xhdpi-v26/ic_launcher_foreground.png', size : 96 },
{ name : 'mipmap-xxhdpi/ic_launcher.png', size : 144 },
{ name : 'mipmap-xxhdpi-v26/ic_launcher_foreground.png', size : 144 },
{ name : 'mipmap-xxxhdpi/ic_launcher.png', size : 192 },
{ name : 'mipmap-xxxhdpi-v26/ic_launcher_foreground.png', size : 192 }
]
});
I would create a PR but I don't see the point as this project is not maintained anymore...
platforms.push({ name : 'android', isAdded : fs.existsSync('platforms/android'), iconsPath : 'platforms/android/app/src/main/res/', icons : [ { name : 'drawable/ic_launcher.png', size : 96 }, { name : 'drawable-hdpi/ic_launcher.png', size : 72 }, { name : 'drawable-ldpi/ic_launcher.png', size : 36 }, { name : 'drawable-mdpi/ic_launcher.png', size : 48 }, { name : 'drawable-xhdpi/ic_launcher.png', size : 96 }, { name : 'drawable-xxhdpi/ic_launcher.png', size : 144 }, { name : 'drawable-xxxhdpi/ic_launcher.png', size : 192 }, { name : 'mipmap-hdpi/ic_launcher.png', size : 72 }, { name : 'mipmap-hdpi-v26/ic_launcher_foreground.png', size : 72 }, { name : 'mipmap-ldpi/ic_launcher.png', size : 36 }, { name : 'mipmap-ldpi-v26/ic_launcher_foreground.png', size : 36 }, { name : 'mipmap-mdpi/ic_launcher.png', size : 48 }, { name : 'mipmap-mdpi-v26/ic_launcher_foreground.png', size : 48 }, { name : 'mipmap-xhdpi/ic_launcher.png', size : 96 }, { name : 'mipmap-xhdpi-v26/ic_launcher_foreground.png', size : 96 }, { name : 'mipmap-xxhdpi/ic_launcher.png', size : 144 }, { name : 'mipmap-xxhdpi-v26/ic_launcher_foreground.png', size : 144 }, { name : 'mipmap-xxxhdpi/ic_launcher.png', size : 192 }, { name : 'mipmap-xxxhdpi-v26/ic_launcher_foreground.png', size : 192 } ] });
this solves the icon issues. but the main app icon is not changing. i.e. the icon in the home screen... ? can you help me out in this..?
Maybe it is just not updating? I have seen cases where you needed to remove and reinstall the app to get the new icon.
Maybe it is just not updating? I have seen cases where you needed to remove and reinstall the app to get the new icon.
it sounds strange.. but i need to reboot the android to see the changes.. .. Any ways thanks for the change in the change code..
I worked a long time with cordova-icon. since 8.1.0 it is not working anymore.
I get this message:
but if I run the app, there is no icon.
I think it has to do with the fact that the icons are now named ic_launcher.png?