gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-03 11:38:47 24 4
gpt4 key购买 nike

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

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-native 项目,但是当直接使用 Android Studio 时,会出现这种情况。

我已经尝试在 Android Studio 中创建新项目,但结果仍然相同。我相信这在我从 Android Studio 3.0 更新到 3.1 后就开始发生了。

有解决此问题或获取更多信息的想法吗?

谢谢。

系统信息:

MacOS High Sierra 10.3.14Macbook Pro(2011 年末)

软件信息:

安卓工作室 3.1.2Java 9.0.4

最佳答案

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

之前我在 /etc/hosts 文件中有一个映射 0.0.0.0 localhost

关于Android Studio - 无法连接到设备或模拟器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50204001/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com