React Native Android: Static Image is not showing in production released apk

霸气de小男生 提交于 2019-11-30 14:03:42
Waleed Arshad

This is the command that did it for me:

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/

take a look at github issue>

I'm using react-native v0.59.9 with shrinkResources true configuration. It makes react-native could not find the assets.

Make sure you do not set shrinkResources on android build.gradle unless the new version of react-native support it later on.

Pawan Maheshwari

Verify whether images are in ../res folder or not ${project}/android/app/src/res. If not then you need to copy images in that folder. That can be done using following react command

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/

Ideally, this happens in Android when images sizes are larger. Another way to avoid such issues at runtime is to optimize image sizes.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!