美文网首页
React Native 打包安卓App报错

React Native 打包安卓App报错

作者: 超人阿亮 | 来源:发表于2018-07-06 10:01 被阅读0次

错误1: unable to load script from assets ‘index.android bundle’ ,make sure your bundle is packaged correctly or youu’re runing a packager server

解决方法:

  1. 在 android/app/src/main 目录下创建一个 assets空文件夹(如果已经存在则忽略这步)

  2. 在项目根目录运行 react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/

    此时assets文件夹中多出两个文件 index.android.bundle, index.android.bundle.meta

  3. 重新运行 react-native run-android

错误2: could not connect to development server.
Try the following to fix the issue:

解决方法:
执行上述第二步,reload即可。

相关文章

网友评论

      本文标题:React Native 打包安卓App报错

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