React Native android could not connect to development server
2017-12-22 14:18
1086 查看
React Native android could not connect to development server
用的是react-native 0.37、Nexus 7 - 5.1.1版本。在项目根目录下运行react-native run-android会在手机上面安装并运行这个apk。然后摇一下手机或者在电脑命令行输入
adb shell input keyevent 82会在手机上面调出一个开发菜单:
点击Reload/Reload JS会重新从开发服务器(也就是你开发用的电脑)获取更新,这样如果你只是更改了项目的js文件的话就不用重新编译即可在手机上面实时观看结果。
但是有时候会出现红色屏幕的错误:could not connect to development server。这里需要从以下几个步骤来解决问题:
检查开发服务器是否在运行:在电脑上用浏览器输入网址localhost:8081查看是否能访问
检查手机是否已经连上而且开户了USB调试模式
adb devices
react-native run-android
经过以上步骤手机应该能连上电脑了,如还是不行的话最好把一些辅助工具关闭,而且,我踩的坑是电脑的Wifi共享精灵!!!关闭之后手机就能连上开发服务器了。再调出开发菜单,选择
Enable Live Reload和
Enable Hot Reloading,这样修改你的JS代码之后只需随手
Ctrl+S一下在手机上就能实时看到结果了!
果
相关文章推荐
- React Native android could not connect to development server
- React—Native开发之 Could not connect to development server(Android)解决方法
- React—Native开发之 Could not connect to development server(Android)解决方法
- react native mac 下真机调试 Could not connect to development server.
- React—Native创建项目时遇到的坑(Could not connect to development server),你需要收藏
- react-native 最新版本爬坑经历(unable to load script from assets 和could not connect to development server.)
- 关于react-native 运行项目中遇到could not connect to development server的问题
- 最新版本React-Native(0.31)开发之Could not connect to development server
- reactNative Could not connect to development server解决思路
- react native mac 下真机调试 Could not connect to development server.
- Could not connect to development server(Android)
- React Native iOS 之Could not connect to development server.
- 【原】Android - could not read ok from ADB Server * failed to start daemon * error: cannot connect to d
- [React Native iOS真机运行输出]Could not connect to development server.
- React Native 误关闭 server 8081运行出现 Could not connect to development server 解决方法
- 【ReactNative】真机上无法调试 could not connect to development server
- “psql: could not connect to server: Connection refused” Error when connecting to remote database
- sqlalchemy.exc.OperationalError: (OperationalError) could not connect to server: Connection refused
- tigase客户端通过ip访问 Not able to connect Android client with local XMPP server
- monkeyrunner自动化测试工具--真机运行提示:could not connect to view server