无法从捆绑“index.android.bundle”

时间:2017-06-10 10:58:20

标签: react-native react-native-android

当我在Android设备上运行react-native应用程序时,它会在红色屏幕上显示错误:

  

无法从捆绑“index.android.bundle”

加载脚本

2 个答案:

答案 0 :(得分:2)

This following steps helped me resolve the problem in following steps.

  • If not than (in project directory) mkdir android/app/src/main/assets

  • 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 run-android

答案 1 :(得分:1)

使用npm版本4.3.0 react-native-cli版本2.01 react-native版本0.49.5

在项目目录中,

  • mkdir android/app/src/main/assets
  • react-native bundle --platform android --dev false --entry-file
    index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res

  • react-native run-android

文件名已从index.android.js更改为index.js