react-native---配置reactnative报红,run-Android时候报错unable to load script from assets 'index.android.bundl
来源:互联网 发布:行政级轿车 知乎 编辑:程序博客网 时间:2024/05/29 09:36
配置react-native环境时候报错:
unable to load script from assets 'index.android.bundle'.Make sure your bundle ispackged correctly or you are running a packger server.
如图:
百度了很久,好像没有多少真正对症的方法。
去stackoverflow看了很多帖子,也是一个个试,最后发现一个不是最佳的回复挺有道理,试了一下果然OK。
说是新版本文件名已经从index.android.js变为了index.js;
至于assets文件夹就是用来存放index.android.bundle等文件用;
按照步骤:
1 新建assets
进入\android\app\src\main新建assets文件夹
2 修改entry–file
根目录cmd运行命令: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
3 运行run-android
重新运行run-android
此时,结果为:
借鉴
阅读全文