您的位置:首页 > 其它

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

2016-10-25 11:16 537 查看


第一步在Android的assets文件夹下创建一下两个文件



只要文件名是这两个就可以了

index.android.bundle 以.bundle 作为后缀名

index.android.map 以.map 作为后缀名

第二步在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/"


然后cd 你创建的项目的根目录下执行下面代码

react-native start > /dev/null 2>&1 &  curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"


接下来再试试run-android,有效果了吗

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐