美文网首页
react-native中的配置常见错误

react-native中的配置常见错误

作者: webhk | 来源:发表于2017-04-10 19:50 被阅读0次

error:Could not get BatchedBridge, make sure your bundle is packaged correctly

解决方案:
方案一:
修改项目中的package.json文件
在scripts模块,添加bundle-android,如图

tupian.png

如下是代码:
"bundle-android": "react-native bundle –-platform android –dev false –entry-file index.android.js –bundle-output android/app/src/main/assets/index.android.bundle –sourcemap-output android/app/src/main/assets/index.android.map –assets-dest android/app/src/main/res/"

方案二:
一键命令生成,在根目录下
启动命令行执行命令: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/

Paste_Image.png

assets路径按照项目情况自行修改

执行成功会生成两个文件

Paste_Image.png

有了这两个文件 你就可以跑起来了

相关文章

网友评论

      本文标题:react-native中的配置常见错误

      本文链接:https://www.haomeiwen.com/subject/gsleattx.html