本地图像在React-Native应用程序发布版本中不可见 [英] Local images are not visible in React-Native app release build
问题描述
在我的本机应用程序中,我有一个"src" 文件夹,其中包含一个 Images 文件夹和screens文件夹.我的 screens 文件夹具有各种 components ,其中我使用以下代码在 Images 中使用本地图像.
In my react-native app I have "src" folder that includes a Images folder and screens folder.My screens folder have various components where I am uing local images from Images using following code.
<Image source={require('src/Images/logo.png')} />
logo.png 是放置在Images文件夹中的图像,现在有更多这样的图像引用.现在,所有这些图像在开发模式下都能很好地显示,但是当我使用gradlew assemblerelease并将apk安装在我的设备上,以这种方式引用的所有图像都消失在某处.不知道是什么原因,所以请帮助我. 我的本机版本是0.40
logo.png is an image placed in Images folder, there are many more such images referenced like this.Now all these images are shown pretty well in development mode but when I generated the release apk using gradlew assemblereleaseand installed the apk on my device all images referenced in this manner disappear somewhere. Don't know what can be the reasons for that so please help me. my react-native version is 0.40
推荐答案
通过以下
react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/ react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/
可以在链接 这篇关于本地图像在React-Native应用程序发布版本中不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!