Skip to content
This repository has been archived by the owner on Oct 19, 2020. It is now read-only.

with cordova-android 8.1.0 it is not working #146

Open
desmeit opened this issue Oct 25, 2019 · 10 comments
Open

with cordova-android 8.1.0 it is not working #146

desmeit opened this issue Oct 25, 2019 · 10 comments

Comments

@desmeit
Copy link

desmeit commented Oct 25, 2019

I worked a long time with cordova-icon. since 8.1.0 it is not working anymore.

I get this message:

  ✓  platforms found: android
  ✓  icon.png exists
  ✓  config.xml exists

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?

@przem93
Copy link

przem93 commented Nov 12, 2019

It is reason why icon is not working.

@Fourie-r
Copy link

I am also facing the same problem. Is there any solution ?

@przem93
Copy link

przem93 commented Dec 11, 2019

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.

@Fourie-r
Copy link

@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 ?

@przem93
Copy link

przem93 commented Dec 11, 2019

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 ?

@Fourie-r
Copy link

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.

@kw-pr
Copy link

kw-pr commented Jul 17, 2020

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 [email protected]: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...

kw-pr added a commit to kw-pr/cordova-icon that referenced this issue Jul 17, 2020
@teceads
Copy link

teceads commented Jul 19, 2020

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..?

@kw-pr
Copy link

kw-pr commented Jul 19, 2020

Maybe it is just not updating? I have seen cases where you needed to remove and reinstall the app to get the new icon.

@teceads
Copy link

teceads commented Jul 20, 2020

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..

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants