Reputation: 3133
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.
Upvotes: 4
Views: 22407
Reputation: 1
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.
Upvotes: 0
Reputation: 4458
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.
Upvotes: 3
Reputation: 851
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 to localhost
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] (or etc/hosts
[*nix] file:
127.0.0.1 localhost
(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 the ipconfig
command.) If, for example, your machine's IPv4 address is 192.168.1.100
then you'd add the line
192.168.1.100 localhost
to 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.")
Upvotes: 1
Reputation: 483
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.
Upvotes: 18