Home » Android » android – Could not open Selected VM debug port (8700)

android – Could not open Selected VM debug port (8700)

Posted by: admin April 23, 2020 Leave a comment


I am trying to debug the android source using Eclipse by following the instructions found at:


I have downloaded the source, and gotten it to build. I follow the directions in the link above and everything is fine until I run the ddms command. At this point, if Eclipse is running I get the error ‘Could not open Selected VM debug port (8700)’. If I close Eclipse, then ddms runs with no problem, and I can the the processes on the emulator. However, if I now open Eclipse, I get the same error.

In any case, no matter what I do, if I attempt to remote debug, it always fails with ‘Failed to connect to remote VM’.

Any ideas?


How to&Answers:

It looks like you have two problems:

  1. You are trying to run DDMS twice. You do not need to run the free standing version of DDMS since there is version of it integrated in Eclipse as part of the Android plug-in. If you change to the DDMS perspective in Eclipse, I’m sure you will find that all the same features are available.

  2. You have not told DDMS which VM you want to debug at localhost:8700. Before you attempt to establish your remote debug connection, you must go to the DDMS perspective and click on the system_process (or whatever process you want to debug).


The Windows Host file that is messed up is at C:\WINDOWS\system32\drivers\etc, and it should contain this line: localhost

If that doesn’t work, then try making the following changes in Eclipse.

Under Window -> Preferences -> Android -> DDMS:

  • Set Base local debugger port to “8601”
  • Check the box that says “Use ADBHOST” and the value should be


I solved it by ending the process “adb.exe” through Task Manager and then reloading the SDK through Windows->Preference..I am running Eclipse Indigo on Win 7 64-bit.


I was having that problem too (Windows 7), even though my /Windows/system32/drivers/etc/hosts file already had localhost in it.

I tried changing the ADBHOST info & port in the eclipse Preferences, but that didn’t do anything.

netstat -b shows ‘’ as the source address for adb and the emulator, but always lists my machine host name as the ‘foreign address.’ On a hunch, I tried debugging with my machine not connected to any network (no WiFi, nothing plugged in)… and it worked! (DDMS was able to connect to the VM on the emulated device and I was able to debug just fine.)

I think that messages sent by DDMS &/or adb are not staying on my local machine (they’re getting sent to my local router). (It’s just a guess; I don’t know how to conclusively test that.) IOW, loopback wasn’t working as it should.

Since I already had in my localhosts, I added the local subnet address of my machine into my hosts file, guessing that DDMS/adb might be using that address (vs. That seemed to solve the problem for me.

So now my hosts file has these lines:       localhost
::1             localhost       localhost

(The local IPv4 address for my machine is . You can check yours with the ipconfig command.)

(I came across some webpages that how to set up a virtual network adapater for Windows that handles loopback, e.g. Setting up a Microsoft Loopback Adapater (from Oracle Distilled), but haven’t had time to take that in and see if that’s a viable solution to all of this, too.)


I solved it by opening the windows Task manager and closing the process “adb.exe”. Then close eclipse and reopen it. It will start properly without any error.


This is for reference. But I guess this might match your case.

Port 8700 is very special port for ddms; there’s no way to change the port.
Port 8700 is used for aggregating the packet from every Dalvik VM.

There will be two cases;

case 1) If you set “Base local debugger port”(in Eclipse ddms preference dialog) to 8700, then you’ll see error – “Can’t bind to local 8700 for debugger”, everytime ddms initiated. But no problem, because if ddms couldn’t bind 8700 to the first VM, then will be connected to 8701, and then 8702 and so on.

case 2) Even if you set “Base local debugger port”(in Eclipse ddms preference dialog) to 8600, you may see error – “Can’t bind to local 8700 for debugger”, in some cases. Because, if your device have more than or equal to 100 dalvik VMs, port assigning to each VM starting from port 8600 may reach to 8700 port. But, no problem occurs same as in case 1).

So, if you really don’t want to see the error, you have to set the “Base local debugger port”in Eclipse ddms preference dialog to 8701 or above.

Stand-alone ddms or android monitor uses different setting file from Eclipse, so it may not make this kind of problems.



Had the same problem, different port numbers in the console output (where I launch ddms) caught my attention

Then from the documentation, I learned that 8600 is the default base port number. Every new process uses the next available port (8601,8602,…). In addition, 8700 is the default active port number (indicating the currently selected process in the dbms)

Here are the steps to debugging Android source+applications

  1. Run emulator
  2. Run ddms
  3. Open Eclipse (It may complain about being unable to connect to 8600. This is because, when Eclipse starts up and if you have Android plugin, it boots up ddms. Since we already have a ddms connected to the device, trying to connect for a second time won’t work)
  4. In the ddms, pick a thread you want to debug (when you highlight it, it will show you the ports that it is using as well as 8700 (e.g. “8649 / 8700”). This means you can use both ports to connect to this process
  5. From eclipse, using the remote debugging configuration, connect to any process you wish (easiest is to highlight the process from within ddms and then connect to 8700)


This type problem occurs when you are using another VM with the same port number. As an example you are using Android SDk full bundle which you have downloaded from the android developer website. Now you want to use Eclipse and plugged in ADT, SDK. There is a high probability to happen this type of error. It happened to me. To overcome this difficulties you can do :
Window-Preferences-Android- Choose DDMS- Change base local debugger port(use 8601 instead of 8600).
It can work. Thanks


I done it by restarting my computer


Just for completeness: (on win 7/Vista) not only you have to make sure line localhost

is present in


you also need to comment out all your other local virtual hosts resolving from This is most probably the case if you’re developing web stuff on the same machine and set it up earlier for different host names looping back to local.


I solved the problem by ONLY close android studio so the eclipse can get ddms


When I execute monitor in $ANDROID_HOME/tools/monitor on Ubuntu 16.04, it shows

Could not open Selected VM debug port (8700). Make sure you do not
have another instance of DDMS or of the eclipse plugin running. If
it’s being used by something else, choose a new port number in the

I tried to do the following:

Under Window -> Preferences -> Android -> DDMS:

Set Base local debugger port to “8601” Check the box that says “Use
ADBHOST” and the value should be

But it still pops up the dialog.

Then I did the following:

[email protected]:~$ netstat -apn |grep 8700
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0*               LISTEN      5044/java       
[email protected]:~$ kill -9 5044
[email protected]:~$ monitor

By doing this, it solved my problem.

Do not know why, but it works for me.