搭建RN环境踩坑(一)Unable to load script from assets ‘index.android bundle’
完整错误:unable to load script from assets ‘index.android bundle’ .Make sure your bundle is packaged correctly or you’re runing a packager server.
解决方法:
- 首先手动在main下建立一个assets文件夹
- 再cmd 进入项目的根目录下执行
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
- 3.最后 react-native run-android 就可以了