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

论坛 期权论坛 脚本     
匿名技术用户   2020-12-27 16:49   11   0

这里写图片描述

第一步在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,有效果了吗

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:7942463
帖子:1588486
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP