Getting "Startup error: could not connect to the remote virtual machine. Connection timeout" when trying to debug my application on my Android device

I tried all the possible options set on the network and on this site, but none of them worked.

I get:

Startup Error: Failed to connect to the remote virtual machine. Connection timeout.

when I try to debug an application on my mobile device. The application works correctly, without any problems, when I work normally

I have currently used these links:

How to enable "Waiting for a debugger" message?

Eclipse Problem - Startup Error: Failed to connect to the remote virtual machine. Connection timeout

Eclipse Error: "Could not connect to remote virtual machine"

Startup Error: Failed to connect to the remote virtual machine

https://forums.oracle.com/forums/thread.jspa?threadID=653343

None of the above work.

+4
source share
4 answers

Go to Window β†’ Settings β†’ General β†’ Network Connections and check if any proxy is installed here, change the "Active Provider" to "Direct" and try again.

+18
source

I don’t know why, but it works for me: First run (or debug) your application in the emulator, and then debug the application on the device (without closing the emulator). let me know if this works for you.

+4
source

I had the same unpleasant problem. I finally found something that works for me: make sure localhosts correctly resolved (and really explicit).

Check if it works when your development machine is not connected to the network (no Wi-Fi, no network cables). If it works under these conditions, perhaps you need to make sure that the addresses are correctly resolved on localhost . Messages that DDMS and adb.exe use to debug and communicate with the virtual machine must correctly resolve to localhost on your computer. (Yes, it is strange that other teams using DDMS and adb work fine, but debugging does not. It seems that something in DDMS or adb needs to be standardized so that they all work under the same conditions.)

If you need to make sure the localhost solution is correct:

1) Make sure this line is in the file /Windows/System32/drivers/etc/hosts [windows] (or etc/hosts [* nix]:

  127.0.0.1 localhost

(you can have any number of spaces between "127.0.0.1" and "localhost")

2) If this does not work, you may also need to add the IPv4 address of your computer to the hosts file and allow it localhost . (You can find out the IPv4 address for your computer using the ipconfig command.) If, for example, your IPv4 address of your computer is 192.168.1.100 , you must add the line

  192.168.1.100 localhost

to your hosts file. (You can add it under the line "127.0.0.1 localhost" in the file.)

I had (1) my host file, but it still did not work (unless my computer was connected to the network). I tried (2) to guess a little, and it worked for me.

BTW: you can verify that adb (and your emulator, if you use it) is listening on ports using the netstat -b command. (Note that in Win7, you need administrator rights for the -b option. I open the command window using the "Run as administrator" command.)

+1
source

This may seem like the obvious answer, but make sure you don't have two emulators - 5554; 5556; ... The debugger has difficulty configuring the port when he does not know which one to connect to.

0
source

Source: https://habr.com/ru/post/903836/


All Articles