Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/196.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Studio-无法连接到设备或模拟器_Android_Android Studio - Fatal编程技术网

Android Studio-无法连接到设备或模拟器

Android Studio-无法连接到设备或模拟器,android,android-studio,Android,Android Studio,我在Android Studio中运行应用程序时遇到问题。当我按Run键时,“选择部署目标”对话框弹出,但我始终无法看到出现任何模拟器或设备。事件日志打印出以下内容并无限期重复: 5/6/18 12:40 PM Gradle sync started 12:40 PM Project setup started 12:41 PM Gradle sync finished in 49s 932ms 12:41 PM Executing tasks: [:app:gen

我在Android Studio中运行应用程序时遇到问题。当我按Run键时,“选择部署目标”对话框弹出,但我始终无法看到出现任何模拟器或设备。事件日志打印出以下内容并无限期重复:

5/6/18
12:40 PM    Gradle sync started

12:40 PM    Project setup started

12:41 PM    Gradle sync finished in 49s 932ms

12:41 PM    Executing tasks: [:app:generateDebugSources]

12:41 PM    Gradle build finished in 15s 765ms

12:44 PM    Unable to open connection to: localhost/0.0.0.0:5037, due to: java.net.ConnectException: Connection refused

12:44 PM    Connection attempts: 1

12:44 PM    Unable to open connection to: localhost/0.0.0.0:5037, due to: java.net.ConnectException: Connection refused

12:44 PM    Connection attempts: 2

12:44 PM    Unable to open connection to: localhost/0.0.0.0:5037, due to: java.net.ConnectException: Connection refused

12:44 PM    Connection attempts: 3

12:44 PM    Unable to open connection to: localhost/0.0.0.0:5037, due to: java.net.ConnectException: Connection refused

12:44 PM    Connection attempts: 4

12:44 PM    Unable to open connection to: localhost/0.0.0.0:5037, due to: java.net.ConnectException: Connection refused

12:44 PM    Connection attempts: 5
我可以使用命令行运行react原生项目,但直接使用Android Studio时,会出现这种情况

我曾尝试在Android Studio中创建新项目,但仍然有相同的结果。我相信这是在我从Android Studio 3.0升级到3.1之后开始的

有没有办法解决这个问题或获取更多信息

谢谢

系统信息:

MacOS High Sierra 10.3.14 MacBookPro(2011年末)

软件信息:

Android Studio 3.1.2
Java 9.0.4

我也有同样的问题,我通过删除
/etc/hosts
中的
0.0.0
映射来修复它


早些时候,我在
/etc/hosts
文件中有一个映射
0.0.0.0localhost

我在Mac上也有一个类似的问题,并通过删除该行修复了它
:1 localhost来自/private/etc/hosts。

我在Mac上也有一个类似的问题,并通过在/etc/hosts上添加行127.0.0.1 localhost来修复它。这很有效。谢谢我想知道为什么这个映射开始成为一个问题,因为我已经有很长时间了。有人能解释一下为什么这是一个问题,以及在/etc/hosts中添加或删除内容如何解决这个问题吗?