RN常见坑点采集

1.unable to load script from assets index.android.bundle. make sure your bundle is packaged correctly
RN-Android 运行模拟器打印此错误,进入命令行运行命令:

a. (in project directory) $mkdir android/app/src/main/assets
b.  $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
c.   $react-native run-android

也可以把这几行命令作为package.json脚本文件的一部分写进去,如:

"android-linux": "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 && react-native run-android"

这样再新建工程遇到问题的时候就可以直接执行脚本命令:

   $npm run android-linux

2.could not install smartsocket listener: Address already in use
这是因为Genymotion模拟器的设置中没有配置AndroidStdio的SDKpath,选择自定义,配置一下路径即可

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容