React-Native:``无法连接到开发服务器''-Android应用程序 [英] React-native: "could not connect to development server"- android app

查看:89
本文介绍了React-Native:``无法连接到开发服务器''-Android应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在遵循有关启动react.js的指南. http://code.tutsplus.com/tutorials/creating-a-dictionary-app-using-react-native-for-android--cms-24969 我安装了node,react,android studio和genymotion模拟器.当我进入在模拟器中构建应用程序的部分时,会出现以下错误:

I am following guide on starting react.js. http://code.tutsplus.com/tutorials/creating-a-dictionary-app-using-react-native-for-android--cms-24969 I installed node, react, android studio and genymotion emulator. When I get to the part of building app in emulator, I get this error:

错误生成图片

我激活了USB调试工具.当我尝试在命令提示符下运行adb devices命令时,它什么也没给我.

I activated USB debuggin tool. When I try to run adb devices command in command prompt, it gives me nothing.

推荐答案

我建议2个步骤(两个步骤都需要解决我的问题)

I would suggest 2 steps (both were required to solve my issue)

  1. 关闭本地防火墙.在osx上,转到安全和隐私"->防火墙"->单击锁定图标->关闭防火墙"

  1. Turn off your local firewall. On osx, go to "Security & Privacy" -> "Firewall" -> Click lock icon -> "Turn off Firewall"

默认端口8081可能正在使用中(即使 lsof 命令另有建议).在启动时尝试另一个端口: react-native start --port = 8088

The default port 8081 may be in use (even if the lsof command suggests otherwise). Try another port on start: react-native start --port=8088

然后在您的设备上摇动它以获取开发菜单,点击设备设置"->调试设备的服务器主机和端口"->输入"XX.XX.XX.XX:8088"(其中x是是您的本地IP)

And on your device, shake it to get the dev menu, tap "Dev Settings" -> "Debug server host & port for device" -> enter "XX.XX.XX.XX:8088" (where x's are your local IP)

这篇关于React-Native:``无法连接到开发服务器''-Android应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆