1

我正在使用 PhoneGap Build 并试图让自适应图标工作。我以前使用具有以下配置的旧图标:

<icon density="mdpi" src="res/icons/android/mipmap-mdpi/launcher_icon.png" />

<icon density="hdpi" src="res/icons/android/mipmap-hdpi/launcher_icon.png" />

<icon density="xhdpi" src="res/icons/android/mipmap-xhdpi/launcher_icon.png" />

<icon density="xxhdpi" src="res/icons/android/mipmap-xxhdpi/launcher_icon.png" />

<icon density="xxxhdpi" src="res/icons/android/mipmap-xxxhdpi/launcher_icon.png" />

但它们看起来非常丑陋。所以我用 Android Studio (Image Asset) 创建了新的自适应图标并将它们导入到我的项目的 config.xml 中(我不使用 Android Studio 来构建或编码)。我将此添加到我的 config.xml 中:

        <edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/application">

            <application android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" />

        </edit-config>



        <resource-file src="res/new/drawable/ic_launcher_background.xml" target="res/drawable/ic_launcher_background.xml" />

        <resource-file src="res/new/drawable/ic_launcher_foreground.xml" target="res/drawable/ic_launcher_foreground.xml" />



        <resource-file src="res/new/mipmap-anydpi-v26/ic_launcher.xml" target="res/mipmap-anydpi-v26/ic_launcher.xml" />

        <resource-file src="res/new/mipmap-anydpi-v26/ic_launcher_round.xml" target="res/mipmap-anydpi-v26/ic_launcher_round.xml" />

        <resource-file src="res/new/mipmap-hdpi/ic_launcher.png" target="res/mipmap-hdpi/ic_launcher.png" />

        <resource-file src="res/new/mipmap-hdpi/ic_launcher_round.png" target="res/mipmap-hdpi/ic_launcher_round.png" />

        <resource-file src="res/new/mipmap-mdpi/ic_launcher.png" target="res/mipmap-mdpi/ic_launcher.png" />

        <resource-file src="res/new/mipmap-mdpi/ic_launcher_round.png" target="res/mipmap-mdpi/ic_launcher_round.png" />

        <resource-file src="res/new/mipmap-xhdpi/ic_launcher.png" target="res/mipmap-xhdpi/ic_launcher.png" />

        <resource-file src="res/new/mipmap-xhdpi/ic_launcher_round.png" target="res/mipmap-xhdpi/ic_launcher_round.png" />

        <resource-file src="res/new/mipmap-xxhdpi/ic_launcher.png" target="res/mipmap-xxhdpi/ic_launcher.png" />

        <resource-file src="res/new/mipmap-xxhdpi/ic_launcher_round.png" target="res/mipmap-xxhdpi/ic_launcher_round.png" />

        <resource-file src="res/new/mipmap-xxxhdpi/ic_launcher.png" target="res/mipmap-xxxhdpi/ic_launcher.png" />

        <resource-file src="res/new/mipmap-xxxhdpi/ic_launcher_round.png" target="res/mipmap-xxxhdpi/ic_launcher_round.png" />

当我安装应用程序时,只显示默认的 PhoneGap 图标。

我究竟做错了什么?我确保所有路径都正确并且也没有构建错误。我什至尝试切换图标并从 GitHub 应用程序使用ic_launcher_background.xmlic_launcher_foreground.xml它们也没有工作,所以我的猜测是问题不在于图标,而在于将它们注入 AndroidManifest.xml 的代码

可能值得注意的是,在构建中我收到此错误:

This app does not have launcher icons defined

我不知道为什么。

4

0 回答 0