react native写的应用在调试模式的时候一切正常,可是生成apk后,在手机上安装图片却不显示,这说明静态文件资源没有被bundle进来。react
进入项目下的android
目录,而后app -> src -> res
,若是图片不存在这个目录下,那就要主动去bundle文件。
在项目根目录下执行这条命令:android
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/
等待操做完成,从新build一次,就能够显示图片了。git
参考: Static Image is not showing in production apk #9451github