[react-native]无法连接到android上的开发服务器

[react-native]无法连接到android上的开发服务器,第1张

概述当我运行“react-nativerun-android”时,它给了我错误:“无法连接到开发服务器……”.>包服务器正在运行,我可以直接从浏览器访问它在移动设备中.>我的Android设备连接到计算机已启用调试我使用adbdevices命令检查它.>我的Android版本是4.4.4所以我不能使用adbreverse命令.>我

当我运行“react-native run-android”时,它给了我错误:“无法连接到开发服务器……”.

>包服务器正在运行,我可以直接从浏览器访问它
在移动设备中.
>我的Android设备连接到计算机已启用调试我
使用adb devices命令检查它.
>我的AndroID版本是4.4.4所以我不能使用adb reverse命令.
>我在Dev设置中设置了ip地址和端口.
> Usb调试已打开.
> OS是windows7.

那么如何修复红色错误屏幕问题?任何建议表示赞赏!

解决方法:

来自Docs:
http://facebook.github.io/react-native/docs/running-on-device.html#method-2-connect-via-wi-fi

方法2:通过Wi-Fi连接

You can also connect to the development server over Wi-Fi. You’ll
first need to install the app on your device using a USB cable, but
once that has been done you can deBUG wirelessly by following these
instructions. You’ll need your development machine’s current IP
address before proceeding.

Open a terminal and type /sbin/ifconfig to find your machine’s IP
address.

Make sure your laptop and your phone are on the same Wi-Fi network. Open your React Native app on your device. You’ll see a red screen with an error. This is OK. The following steps will fix that. Open the in-app Developer menu. Go to Dev Settings → DeBUG server host for device. Type in your machine’s IP address and the port of the local dev server (e.g. 10.0.1.1:8081).Go back to the Developer menu and select Reload Js.
总结

以上是内存溢出为你收集整理的[react-native]无法连接到android上的开发服务器全部内容,希望文章能够帮你解决[react-native]无法连接到android上的开发服务器所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1102670.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-28
下一篇 2022-05-28

发表评论

登录后才能评论

评论列表(0条)

保存