React Native Genymotion配置

按照官网介绍:


下载地址:https://www.genymotion.com/download

mac直接下载,下载完毕,安装时可以选择个人版本(免费的)


模拟器创建完毕,运行native项目报错:

unable to load script from assets 'index.android.bundle'


直接在电脑浏览器上打开:http://localhost:8081/index.android.bundle?platform=android 就可以查看到当前最终编译成的文件:

可以看到:Cannot find entry file index.android.js in any of the roots



解决方案:

1、

I've encountered the same issue while following the React Native tutorial (developing on Linux and targeting Android).

This issue helped me resolve the problem in following steps.

(1)(in project directory) mkdir 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

(3)react-native run-android

You can automate the above steps by placing them in scripts part of package.json like this:

"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"

Then you can just execute npm run android-linux from your command line every time.


参考地址:Unable to load script from assets index.android.bundle on windows


2、运行 react-native run-android,在模拟器中:





设置完毕

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

推荐阅读更多精彩内容