英文:
Change the app icon for android and iOs in MAUI
问题
我尝试更改 MAUI 项目中的应用图标,但无法完成。
我已将两个图像添加到 AppIcon 文件夹中(我尝试了 png 和 svg,但都不起作用)
并将 csproj 文件更改为新的图标
<MauiIcon Include="Resources\AppIcon\coolcoicon.svg" ForegroundFile="Resources\AppIcon\coolcoiconbg.svg" Color="#000000" />
我已清理了解决方案和项目。
然而,当我尝试在 Android 模拟器中运行应用程序时,我遇到以下错误
错误 APT2260 资源 mipmap/appicon(又名 com.coolco.coolcoapp:mipmap/appicon)未找到。
错误 APT2260 资源 mipmap/appicon_round(又名 com.coolco.coolcoapp:mipmap/appicon_round)未找到。
错误 APT2067 处理清单失败。
英文:
I am trying to change the app icon in a MAUI project but I am unable to do it.
I have added two images to the AppIcon folder ( I tried png and svg but none of them work)
And changed the csproj file to the new icons
<MauiIcon Include="Resources\AppIcon\coolcoicon.svg" ForegroundFile="Resources\AppIcon\coolcoiconbg.svg" Color="#000000" />
I have cleaned the solution and the project.
However, when I try to play the app in the android emulator I have these error
Error APT2260 resource mipmap/appicon (aka com.coolco.coolcoapp:mipmap/appicon) not found.
Error APT2260 resource mipmap/appicon_round (aka com.coolco.coolcoapp:mipmap/appicon_round) not found.
Error APT2067 failed processing manifest.
答案1
得分: 5
请检查/平台/Andorid中的AndroidManifest.xml文件。其中有一行代码如下:
<application ... android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" ...>
当你在项目的csproj文件中更改Appicon时,你也需要更改这行代码以适用于Android。例如:
<application ... android:icon="@mipmap/coolcoicon" ...>
android:roundIcon
只用于Android 7.1。你可以直接删除它。我已经测试过,应用程序图标成功更改。
你也可以将图标的文件名设置为默认值,就像H.A.H所说。
英文:
Please check the AndroidManifest.xml in the /Platforms/Andorid. And there is such one line code in it:
<application ... android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" ...>
When you change the Appicon in the project's csproj file. You also need to change this line for the android. Such as:
<application ... android:icon="@mipmap/coolcoicon" ...>
The android:roundIcon
only used for the android 7.1. And you can delete it directly. I have tested this, and the app icon changed successfully.
You can also set the icon's file name as the default like H.A.H said.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论