收到“启动错误:无法连接到远程虚拟机。连接超时”当尝试在我的 Android 设备上调试我的应用程序时
我尝试了网上和本网站上给出的所有可能的选项,但没有一个起作用。
我得到:
启动错误:无法连接到远程虚拟机。连接超时。
当我尝试在移动设备上调试我的应用程序时。 当我正常运行时,应用程序运行正常,没有任何问题,
我现在至少使用了这些链接:
Eclipse 问题 - 启动错误:无法连接到远程虚拟机。连接超时
https://forums.oracle.com/forums/ thread.jspa?threadID=653343
以上似乎都不起作用。
I tried all the possible options given on net and on this site, but none of them worked.
I am getting:
Launch error: Failed to connect to remote VM. Connection timed out.
when I am trying to debug my application on my mobile device.
the application runs properly with out any issue when I am running normally
I have used at lease these links by now:
How to resolve "Waiting for Debugger" message?
Eclipse issue - Launch error: Failed to connect to remote VM. Connection timed out
Eclipse Error: "Failed to connect to remote VM"
Launch error: Failed to connect to remote VM
https://forums.oracle.com/forums/thread.jspa?threadID=653343
None of the above seem to work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
转到窗口 ->首选项->一般->网络连接,检查此处是否设置了代理,将“Active Provider”更改为“Direct”,然后重试。
Go to Window -> Preferences -> General -> Network Connections, and check if there is any proxy set here, change the 'Active Provider' to be 'Direct' and try again.
我不知道为什么,但这对我有用:
首先在模拟器中运行(或调试)您的应用程序,然后在设备上调试应用程序(无需关闭模拟器)。
让我知道这是否适合您。
I dont know why, but this works for me:
First Run(or Debug) your application in an emulator and then Debug the application on the device (without closing the emulator).
let me know if this works for you.
我也遇到了同样令人沮丧的问题。我终于找到了对我有用的东西:确保 localhosts 被正确解析(而且非常明确)。
测试一下当您的开发机器未连接网络(无 WiFi、无网线)时它是否可以工作。如果它在这些条件下确实有效,那么您可能需要确保地址正确解析为
localhost
。 DDMS 和 adb.exe 用于调试和与 VM 通信的消息必须正确解析为计算机上的localhost
。 (是的,奇怪的是,使用 DDMS 和 adb 的其他命令工作得很好,但调试却不行。似乎 DDMS 或 adb 中的某些内容需要标准化,以便它们都在相同的条件下工作。)如果您需要确保事情正确解析为
localhost
:1)确保此行位于您的
/Windows/System32/drivers/etc/hosts
[windows](或etc/hosts
[*nix] 文件:(“127.0.0.1”和“localhost”之间可以有任意数量的空格)
2)如果这不起作用,那么您可能还需要将 PC 的 IPv4 地址添加到主机文件中,并将其解析为
localhost
。 (您可以使用ipconfig
命令找到您计算机的 IPv4 地址。)例如,如果您计算机的 IPv4 地址是192.168.1.100
,那么您需要添加行到您的主机文件。 (您可以将其添加到文件中的“127.0.0.1 localhost”行下方。)
我的主机文件中有 (1),但它仍然无法工作(除非我的电脑未连接到网络)。我尝试了(2)一点猜测,这对我有用。
顺便说一句:您可以使用
netstat -b
命令验证 adb(以及您的模拟器,如果您正在运行模拟器)是否正在侦听端口。 (请注意,在 Win7 上,您需要-b
选项的管理员权限。我使用“以管理员身份运行”打开命令窗口。)I've been having the same frustrating problem. I finally found something that is working for me: making sure
localhosts
is being resolved correctly (and really explicitly).Test to see if it works when your development machine is not connected to the net (no WiFi, no network cables). If it does work under those conditions, then it may be that you need to make sure that addresses are resolving to
localhost
properly. The messages that DDMS and adb.exe use for debugging and communicating to the VM must properly resolve tolocalhost
on your machine. (Yes, it's odd that other commands using DDMS & adb work just fine but debugging doesn't. Seems that something in DDMS or adb needs to be standardized so they all work under the same conditions.)If you need to make sure that things are resolving to
localhost
properly:1) Make sure that this line is in your
/Windows/System32/drivers/etc/hosts
[windows] (oretc/hosts
[*nix] file:(you can have any amount of whitespace between "127.0.0.1" and "localhost")
2) If that doesn't work, then you may need to also add your PC's IPv4 address to the hosts file, and resolve it to
localhost
. (You can find out the IPv4 address for your machine with theipconfig
command.) If, for example, your machine's IPv4 address is192.168.1.100
then you'd add the lineto your hosts file. (You can add it below the "127.0.0.1 localhost" line in the file.)
I had (1) in my hosts file but it still wasn't working (unless my PC wasn't connected to the net). I tried (2) on a bit of a guess, and that worked for me.
BTW: You can verify that adb (and your emulator if you're running one) is listening on ports by using the
netstat -b
command. (Note that on Win7 you need admin privileges for the-b
option. I open a command window using "Run as Administrator.")可能看起来是一个显而易见的答案,但请确保您没有运行两个模拟器 - 5554; 5556; ...当调试器不知道要连接到哪个端口时,它很难设置端口。
May seem like an obvious answer but make sure you don't have two emulators running - 5554; 5556; ... The debugger has difficulty setting the port when it doesn't know which one to connect to.