美文网首页
Could not get BatchedBridge, mak

Could not get BatchedBridge, mak

作者: 一直搬着砖 | 来源:发表于2017-03-03 16:39 被阅读0次

    好像在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/" ,类似下面这样:

    scripts
    3、命令行运行 react-native run-android

    相关文章

      网友评论

          本文标题:Could not get BatchedBridge, mak

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