Could not get BatchedBridge, make sure your bundle is packaged correctly
好像在Android上使用React Native 没有iOS那么顺利,首先android的里面的服务器ip和端口不像iOS那样写在程序中,需要像下面这样进行配置:
Android 配置 ip然后就是运行的时候,会遇到文章标题中的问题Could not get BatchedBridge, make sure your bundle is packaged correctly
。遇到这个问题,解决方案如下:
1、在命令行下面运行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 的scripts中添加以下节点:
"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/"
,类似下面这样:
3、命令行运行
react-native run-android
。
更多相关文章
- 单点登录(三)| JIRA 安装及 JIRA 集成 CAS 实践
- Android实现应用开机自启动
- 献给android原生应用层开发初学者技术架构选型和整合的方案思路(
- android中的配置权限
- Android(安卓)studio 设置签名
- pinpoint安装与配置
- 分环境配置
- 如何在后台运行Linux命令?
- No.11 使用firewall配置的防火墙策略的生效模式