React Native 0.60 - ic_launcher_round 发布 Bundle/Build 缺失
React Native 0.60 - ic_launcher_round missing for Release Bundle/Build
我正在尝试生成一个 react-native
项目的 release
版本,但遇到 ic_launcher_round.png
未包含在内的问题;它只是显示默认的 android
一个。
我有以下图标:
android/app/src/main/res
:
- mipmap-hdpi
- ic_launcher.png
- ic_launcher_round.png
- mipmap-mdpi
- ic_launcher.png
- ic_launcher_round.png
- mipmap-xhdpi
- ic_launcher.png
- ic_launcher_round.png
- mipmap-xxhdpi
- ic_launcher.png
- ic_launcher_round.png
- mipmap-xxxhdpi
- ic_launcher.png
- ic_launcher_round.png
此外,我在 AndroidManifest.xml
:
中指定了圆形图标
<application
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
>
...
</application>
当我 运行 react-native run-android
时,包含 ic_launcher_round
,我可以看到我的自定义图标显示在设备上。按照 react-native
中的步骤创建 release
构建:
cd android
./gradlew bundleRelease
cd .. && react-native run-android --variant=release
这成功地将 .apk
文件捆绑、构建并安装到我的 phone、,但没有正确的图标;它显示默认 android.
有人见过这个问题吗?我似乎无法 google 处理这个新构建过程的解决方案(对于 react-native 0.60
,使用 ./gradlew bundleRelease
而不是 react-native bundle
或 ./gradlew assembleRelease
)
编辑:代码和所有插件都已从 react-native
的先前版本迁移而来,并且在 debug
和 release
版本上完美运行;这个问题专门针对 release
使用当前设置构建时缺少图标的问题。请相应地限制评论。
将 ic_launcher.png 和 ic_launcher_round.png 重命名为 my_ic_launcher.png
在清单中进行更改:
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/my_ic_launcher"
android:roundIcon="@mipmap/my_ic_launcher_round"
>
清理并构建。
src/main
和 src/release
中的 res
文件夹包含两个文件:
- ic_launcher_foreground.xml
- ic_launcher_background.xml
还有一个 drawable
文件夹,其中重复了两个相同的文件。只需删除这些文件(4 个位置总共 8 个文件)并强制应用回退到各个 mipmap
文件夹中指定的 .png
文件,即可使图标在 debug
中正确显示release
构建。
我正在尝试生成一个 react-native
项目的 release
版本,但遇到 ic_launcher_round.png
未包含在内的问题;它只是显示默认的 android
一个。
我有以下图标:
android/app/src/main/res
:
- mipmap-hdpi
- ic_launcher.png
- ic_launcher_round.png
- mipmap-mdpi
- ic_launcher.png
- ic_launcher_round.png
- mipmap-xhdpi
- ic_launcher.png
- ic_launcher_round.png
- mipmap-xxhdpi
- ic_launcher.png
- ic_launcher_round.png
- mipmap-xxxhdpi
- ic_launcher.png
- ic_launcher_round.png
此外,我在 AndroidManifest.xml
:
<application
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
>
...
</application>
当我 运行 react-native run-android
时,包含 ic_launcher_round
,我可以看到我的自定义图标显示在设备上。按照 react-native
中的步骤创建 release
构建:
cd android
./gradlew bundleRelease
cd .. && react-native run-android --variant=release
这成功地将 .apk
文件捆绑、构建并安装到我的 phone、,但没有正确的图标;它显示默认 android.
有人见过这个问题吗?我似乎无法 google 处理这个新构建过程的解决方案(对于 react-native 0.60
,使用 ./gradlew bundleRelease
而不是 react-native bundle
或 ./gradlew assembleRelease
)
编辑:代码和所有插件都已从 react-native
的先前版本迁移而来,并且在 debug
和 release
版本上完美运行;这个问题专门针对 release
使用当前设置构建时缺少图标的问题。请相应地限制评论。
将 ic_launcher.png 和 ic_launcher_round.png 重命名为 my_ic_launcher.png
在清单中进行更改:
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/my_ic_launcher"
android:roundIcon="@mipmap/my_ic_launcher_round"
>
清理并构建。
src/main
和 src/release
中的 res
文件夹包含两个文件:
- ic_launcher_foreground.xml
- ic_launcher_background.xml
还有一个 drawable
文件夹,其中重复了两个相同的文件。只需删除这些文件(4 个位置总共 8 个文件)并强制应用回退到各个 mipmap
文件夹中指定的 .png
文件,即可使图标在 debug
中正确显示release
构建。