Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ionic app icon not change in android

I have project in ionic, I already set icon using ionic CLI.

In iOS the icon is changed, but in android its not changed.

Here is my config.xml:

<platform name="android">
    <icon src="resources/android/icon/drawable-ldpi-icon.png" density="ldpi"/>
    <icon src="resources/android/icon/drawable-mdpi-icon.png" density="mdpi"/>
    <icon src="resources/android/icon/drawable-hdpi-icon.png" density="hdpi"/>
    <icon src="resources/android/icon/drawable-xhdpi-icon.png" density="xhdpi"/>
    <icon src="resources/android/icon/drawable-xxhdpi-icon.png" density="xxhdpi"/>
    <icon src="resources/android/icon/drawable-xxxhdpi-icon.png" density="xxxhdpi"/>
    <splash src="resources/android/splash/drawable-port-ldpi-screen.png" density="port-ldpi"/>
    <splash src="resources/android/splash/drawable-port-mdpi-screen.png" density="port-mdpi"/>
    <splash src="resources/android/splash/drawable-port-hdpi-screen.png" density="port-hdpi"/>
    <splash src="resources/android/splash/drawable-port-xhdpi-screen.png" density="port-xhdpi"/>
    <splash src="resources/android/splash/drawable-port-xxhdpi-screen.png" density="port-xxhdpi"/>
    <splash src="resources/android/splash/drawable-port-xxxhdpi-screen.png" density="port-xxxhdpi"/>
</platform>

I checked plaftorm/android/res but icon and splashscreen are not changed.

I delete and re add the platform but it has no effect.

EDITED:

I sure image exists in resources directory and like I said before i already use ionic CLI command ionic resources

this my resources icon file this icon in platform ios file3 and this icon in platform android file2

like image 716
aiwiguna Avatar asked Nov 07 '16 04:11

aiwiguna


2 Answers

It's a cordova issue. https://github.com/driftyco/ionic-cli/issues/1608 Uninstall cordova(6.4.0) and downgrade it to 6.3.1

npm uninstall -g cordova npm install -g [email protected]

After that remove the Android platform and add it again.

like image 82
mcrvaz Avatar answered Nov 11 '22 01:11

mcrvaz


TO CHANGE IONIC DEFAULT APP ICON

If you're using windows PC to execute your CLI. Do these 5 STEPS action

STEP 1

install capacitor resources by running npm install capacitor-resources -g

STEP 2

Create just 4 customized images (app icon, splash screen, icon background, and icon foreground) using any image editing software.

a. app icon - (a png file with dimension 1024x1024) and save as icon.png inside <Project Directory>/resources/ Let it replace the default

b. splash screen - (a png file with dimension 2732x2732) and save as splash.png inside <Project Directory>/resources/ Let it replace the default

c. icon background - (a png file with dimension 432x432) You may decide to make the color transparent or not and save as icon-background.png inside <Project Directory>/resources/android/

b. icon foreground - (a png file with dimension 432x432) and save as icon-foreground.png inside <Project Directory>/resources/android/ icon foreground is just same as app icon. it is the logo that will represent your app in app collections.

STEP 3

let capacitor help you to make the icon and splash in multiple dimensions by running

ionic cordova resources

STEP 4

copy the resources to the android build by running cordova-res --skip-config --copy

STEP 5

then run either of the following from the project directory, depending on whichever works for you. number 1 worked for me.

  1. cd android && gradlew assembleDebug && cd ..

  2. ionic cordova run android

like image 25
Akinsam Avatar answered Nov 11 '22 01:11

Akinsam