React Native 0.60 - 发布包/构建缺少 ic_launcher_round [英] React Native 0.60 - ic_launcher_round missing for Release Bundle/Build
问题描述
我正在尝试生成一个 react-native
项目的 release
构建,并且遇到了 ic_launcher_round.png
的问题,而不是被包括在内;它只是显示默认的 android
一.
I'm trying to generate a release
build of a react-native
project, and am having issues with the ic_launcher_round.png
not being included; it is simply showing the default android
one.
我有以下图标:
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
中指定了圆形图标:
Also, I have rounded icons specified in 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
构建:
When I run react-native run-android
, the ic_launcher_round
is included, and I can see my custom icon displayed on device. Following the steps from react-native
for creating a release
build:
cd android
./gradlew bundleRelease
cd .. && react-native run-android --variant=release
这成功地将 .apk
文件捆绑、构建并安装到我的手机上,但没有正确的图标;它显示默认的 android.
This successfully bundles, builds and installs the .apk
file onto my phone, but without the correct icon; it displays the default android.
有人看到过这个问题吗?我似乎无法搜索处理这个新构建过程的解决方案(对于 react-native 0.60
,使用 ./gradlew bundleRelease
而不是 react-native bundle
或 ./gradlew assembleRelease
)
Has anyone seen this issue? I can't seem to google a solution that handles this new build process (for react-native 0.60
, using ./gradlew bundleRelease
instead of react-native bundle
or ./gradlew assembleRelease
)
代码和所有插件已从react-native
的旧版本迁移,并在debug
和release
构建上完美运行;这个问题特别是关于 release
构建中缺少图标的当前设置.请相应地限制评论.
Code and all plugins have been migrated from pervious version of react-native
and function perfectly on debug
and release
builds; this question is specifically about lack of icon in release
build with current settings. Please limit comments accordingly.
推荐答案
src/main
和 src/release
中的 res
文件夹包含两个文件:
The res
folder in both src/main
and src/release
contained two files:
- ic_launcher_foreground.xml
- ic_launcher_background.xml
以及一个 drawable
文件夹,其中重复了相同的两个文件.只需删除这些文件(4 个位置共 8 个文件)并强制应用回退到各种 mipmap
文件夹中指定的 .png
文件,即可使图标正确显示在 debug
和 release
构建中.
As well as a drawable
folder with the same two files repeated. Simply removing these files (total of 8 files across 4 locations) and forcing the app to fallback to the .png
files specified in the various mipmap
folders allows the icon to display correctly in both debug
and release
builds.
这篇关于React Native 0.60 - 发布包/构建缺少 ic_launcher_round的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!