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