简体   繁体   English

离子应用程序图标在android中不会改变

[英]Ionic app icon not change in android

I have project in ionic , I already set icon using ionic CLI .我有ionic项目,我已经使用ionic CLI设置了图标。

In iOS the icon is changed, but in android its not changed.在 iOS 中,图标已更改,但在 android 中未更改。

Here is my config.xml:这是我的 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.我检查了平台/android/res,但图标和闪屏没有改变。

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我确定图像存在于资源目录中,就像我之前所说的那样,我已经使用了 ionic CLI 命令ionic resources

this my resources icon这是我的资源图标档案 this icon in platform ios ios平台中的这个图标文件 3 and this icon in platform android和平台android中的这个图标文件 2

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 https://github.com/driftyco/ionic-cli/issues/1608卸载cordova(6.4.0) 并降级到6.3.1

npm uninstall -g cordova npm install -g cordova@6.3.1 npm uninstall -g cordova npm install -g cordova@6.3.1

After that remove the Android platform and add it again.之后删除Android平台并再次添加。

TO CHANGE IONIC DEFAULT APP ICON更改离子默认应用程序图标

If you're using windows PC to execute your CLI.如果您使用 Windows PC 来执行 CLI。 Do these 5 STEPS action做这5个步骤动作

STEP 1

install capacitor resources by running npm install capacitor-resources -g通过运行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.使用任何图像编辑软件仅创建 4 个自定义图像(应用程序图标、启动画面、图标背景和图标前景)。

a. a. app icon - (a png file with dimension 1024x1024) and save as icon.png inside <Project Directory>/resources/ Let it replace the default应用程序图标- (a png file with dimension 1024x1024)并在<Project Directory>/resources/保存为icon.png让它替换默认值

b.splash screen - (a png file with dimension 2732x2732) and save as splash.png inside <Project Directory>/resources/ Let it replace the default启动画面- (a png file with dimension 2732x2732)并在<Project Directory>/resources/保存为splash.png让它替换默认值

c. 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/图标背景- (a png file with dimension 432x432)您可以决定是否使颜色透明并在<Project Directory>/resources/android/保存为icon-background.png

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. icon foreground - (a png file with dimension 432x432)并在<Project Directory>/resources/android/保存为icon-foreground.png图标前景与应用程序图标相同。 it is the logo that will represent your app in app collections.它是将在应用程序集合中代表您的应用程序的徽标。

STEP 3第 3 步

let capacitor help you to make the icon and splash in multiple dimensions by running让电容帮你制作图标并通过运行在多个维度上飞溅

ionic cordova resources

STEP 4第 4 步

copy the resources to the android build by running cordova-res --skip-config --copy通过运行cordova-res --skip-config --copy将资源复制到 android 版本

STEP 5第 5 步

then run either of the following from the project directory, depending on whichever works for you.然后从项目目录运行以下任一操作,具体取决于哪个适合您。 number 1 worked for me. 1号为我工作。

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

  2. ionic cordova run android

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM