Could not get BatchedBridge, make sure your bundle is packaged correctly
来源:互联网 发布:天敏机顶盒安装软件 编辑:程序博客网 时间:2024/06/07 12:02
今天在学习ReactNative时,研究到ReactNative嵌入到原生app时遇到的一个问题,导致程序跳转的时候就crash,错误日志如下:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
几经查找,在facebook的github上的issues中找到了问题的解决方式,
链接 https://github.com/facebook/react-native/issues/9336
这是个已经被closed的问题,
看到国外的有人也受该问题的困扰,有人给了一下的链接
https://stackoverflow.com/questions/34175416/how-to-use-offline-bundle-on-android-for-react-native-project
中完美的解决了我的问题。
说下我用的两种解决方式吧:
1. 修改项目中的package.json文件
看下你的文件中的是否有scripts模块,添加bundle-android,如图
这里面的命令过长,没有截完整,全部命令如下:
“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/”
注意:命令中的assets路径按照自己的项目自行调整
2. 使用命令行直接生成,不用修改package.json,不管有没有bundle-android模块
首先cd到项目的根目录中,执行命令react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output src/main/assets/index.android.bundle --assets-dest src/main/res/
运行效果如下图:
还是那句话,assets路径自己按照项目情况自行修改
ok,至上面的两种方法最后生成的效果是一样的,都可以看到在项目的assets目录下生成了了来了两个文件,
其中第二个文件 .meta亲测可以删除
over,以上的问题完美解决,愉快的来ReactNative吧
- Could not get BatchedBridge, make sure your bundle is packaged correctly
- could not get batchedbridge, make sure your bundle is packaged correctly
- Could not get BatchedBridge, make sure your bundle is packaged correctly
- could not get batchedbridge, make sure your bundle is packaged correctly
- could not get batchedbridge, make sure your bundle is packaged correctly
- Could not get BatchedBridge, make sure your bundle is packaged correctly
- Could not get BatchedBridge, make sure your bundle is packaged correctly
- react-native 运行报Could not get BatchedBridge, make sure your bundle is packaged correctly 错误
- Could not get BatchedBridge, make sure your bundle is packaged correctly问题解决
- Could not get BatchedBridge, make sure your bundle is packaged correctly
- Could not get BatchedBridge, make sure your bundle is packaged correctly
- could not get batchedbridge, make sure your bundle is packaged correctly
- React-native 常见错误:Could not get BatchedBridge, make sure your bundle is packaged correctly
- react-native报错Could not get BatchedBridge, make sure your bundle is packaged correctly
- Could not get BatchedBridge, make sure your bundle is packaged correctly
- Could not get BatchedBridge, make sure your bundle is packaged correctly
- React Native 报错 Could not get BatchedBridge, make sure your bundle is packaged correctly.
- 红屏问题"Could not get BatchedBridge, make sure your bundle is packaged correctly"
- SVM-支持向量机详解(三)
- txt文件参数化200用户,返回在表格中查看只能看到100行数据
- 关于cvReleaseImage函数的用法说明
- Mysql Explain超实用中文手册
- IOS界面开发之UIButton
- Could not get BatchedBridge, make sure your bundle is packaged correctly
- jQuery Validate验证框架详解
- Ubuntu安装eclipse
- 时间触发调度器
- 网络编程--udp--客户端--服务端--Socket
- MyBatis(4):动态SQL
- PowerQuery合并多个csv文件
- HDU 1257 最少拦截系统 贪心
- elasticsearch--自启动设置