无法打开选定的 VM 调试端口 (8700)

发布于 2024-08-31 21:42:02 字数 427 浏览 6 评论 0原文

我正在尝试按照以下位置的说明使用 Eclipse 调试 android 源:

http://source.android。 com/using-eclipse

我已经下载了源代码,并进行了构建。我按照上面链接中的说明操作,一切正常,直到运行 ddms 命令。此时,如果 Eclipse 正在运行,我会收到错误“无法打开选定的 VM 调试端口 (8700)”。如果我关闭 Eclipse,则 ddms 运行不会有问题,并且我可以在模拟器上运行进程。但是,如果我现在打开 Eclipse,则会收到相同的错误。

无论如何,无论我做什么,如果我尝试远程调试,它总是会失败并显示“无法连接到远程虚拟机”。

有什么想法吗?

谢谢

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

http://source.android.com/using-eclipse

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?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(12

满身野味 2024-09-07 21:42:02

看起来您有两个问题:

  1. 您正在尝试运行 DDMS 两次。您不需要运行 DDMS 的独立版本,因为它的版本作为 Eclipse 的一部分集成在 Eclipse 中。 Android 插件。如果您更改为 Eclipse 中的 DDMS 透视图,我相信您会发现所有相同的功能都可用。

  2. 您尚未告诉 DDMS 您想要在 localhost:8700 调试哪个 VM。 在尝试建立远程调试连接之前,您必须转到 DDMS 透视图并单击 system_process(或无论您想要调试什么进程)。

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).

别想她 2024-09-07 21:42:02

混乱的 Windows Host 文件位于 C:\WINDOWS\system32\drivers\etc,它应该包含以下行:

127.0.0.1 localhost

如果这不起作用,则尝试在 Eclipse 中进行以下更改。

在窗口下 ->首选项->安卓-> DDMS:

  • 将基本本地调试器端口设置为“8601”
  • 选中“使用 ADBHOST”框,值应为 127.0.0.1

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

127.0.0.1 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 127.0.0.1
爱你是孤单的心事 2024-09-07 21:42:02

我通过任务管理器结束进程“adb.exe”,然后通过 Windows-> 首选项重新加载 SDK 解决了这个问题。我在 Win 7 64 位上运行 Eclipse Indigo。

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.

望笑 2024-09-07 21:42:02

我也遇到了这个问题(Windows 7),即使我的 /Windows/system32/drivers/etc/hosts 文件中已经有 127.0.0.1 localhost

我尝试更改 ADBHOST 信息 & port 在 eclipse 首选项中,但这没有做任何事情。

netstat -b 将“127.0.0.1”显示为 adb 和模拟器的源地址,但始终将我的计算机主机名列为“外部地址”。凭直觉,我尝试用我的机器未连接到任何网络(没有 WiFi,没有插入任何东西)进行调试...并且成功了! (DDMS 能够连接到模拟设备上的虚拟机,并且我能够很好地进行调试。)

我认为 DDMS 和/或 adb 发送的消息不会保留在我的本地计算机上(它们会发送到我的本地路由器)。 (这只是一个猜测;我不知道如何最终测试它。) IOW,环回没有按应有的方式工作。

由于我的本地主机中已经有 127.0.0.1,因此我将计算机的本地子网地址添加到主机文件中,猜测 DDMS/adb 可能正在使用该地址(相对于 127.0.0.1)。这似乎为我解决了问题。

所以现在我的主机文件有这些行:(

127.0.0.1       localhost
::1             localhost
192.168.1.102       localhost

我的机器的本地 IPv4 地址是 192.168.1.102 。您可以使用 ipconfig 命令检查您的地址。)

(我遇到过一些网页介绍了如何为 Windows 设置处理环回的虚拟网络适配器,例如 设置 Microsoft Loopback 适配器(来自 Oracle Distilled),但还没有时间考虑这一点,看看这是否也是解决所有问题的可行解决方案。)

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

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

netstat -b shows '127.0.0.1' 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 127.0.0.1 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. 127.0.0.1). That seemed to solve the problem for me.

So now my hosts file has these lines:

127.0.0.1       localhost
::1             localhost
192.168.1.102       localhost

(The local IPv4 address for my machine is 192.168.1.102 . 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.)

负佳期 2024-09-07 21:42:02

我通过打开 Windows 任务管理器并关闭进程“adb.exe”解决了这个问题。然后关闭eclipse并重新打开它。它将正常启动,不会出现任何错误。

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.

梦行七里 2024-09-07 21:42:02

这是供参考的。但我想这可能符合你的情况。

8700端口是ddms非常特殊的端口;没有办法改变端口。
端口 8700 用于聚合来自每个 Dalvik VM 的数据包。

会有两种情况;

情况 1) 如果将“基本本地调试器端口”(在 Eclipse ddms 首选项对话框中)设置为 8700,则每次启动 ddms 时,您都会看到错误 -“无法绑定到调试器的本地 8700”。但没问题,因为如果 ddms 无法将 8700 绑定到第一个虚拟机,那么将连接到 8701,然后是 8702,依此类推。

情况 2) 即使将“基本本地调试器端口”(在 Eclipse ddms 首选项对话框中)设置为 8600,在某些情况下,您也可能会看到错误 -“无法绑定到调试器的本地 8700”。因为,如果您的设备有超过或等于 100 个 dalvik 虚拟机,则为每个虚拟机分配的端口从端口 8600 开始可能会达到 8700 端口。但是,不会出现与情况 1) 相同的问题。

因此,如果您确实不想看到该错误,则必须将 Eclipse ddms 首选项对话框中的“基本本地调试器端口”设置为 8701 或更高版本。

独立的ddms或android监视器使用与Eclipse不同的设置文件,因此可能不会出现此类问题。

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.

~

↙温凉少女 2024-09-07 21:42:02

有同样的问题,控制台输出中的不同端口号(我启动 ddms 的地方)引起了我的注意

然后来自 文档,我了解到8600是默认的基本端口号。每个新进程都使用下一个可用端口(8601,8602,...)。另外,8700是默认的活动端口号(表示dbms中当前选择的进程)

以下是调试Android源+应用程序的步骤

  1. 运行模拟器
  2. 运行ddms打开
  3. Eclipse(它可能会抱怨无法连接到8600。这是因为,当 Eclipse 启动时,如果您有 Android 插件,它会启动 ddms 因为我们已经有一个 ddms 连接到设备,所以尝试第二次连接将不起作用)
  4. 在 ddms 中,选择一个您想要的线程。进行调试(当您突出显示它时,它将显示它正在使用的端口以及 8700(例如“8649 / 8700”)。这意味着您可以使用这两个端口连接到此进程
  5. 从 eclipse,使用远程调试配置,连接到您想要的任何进程(最简单的是从 ddms 中突出显示该进程,然后连接到 8700)

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)
泪之魂 2024-09-07 21:42:02

当您使用具有相同端口号的另一台虚拟机时,会出现此类问题。例如,您使用的是从 Android 开发者网站下载的 Android SDK 完整包。现在你想使用Eclipse并插入ADT、SDK。发生此类错误的可能性很大。这发生在我身上。为了克服这个困难,你可以这样做:
Window-Preferences-Android- 选择 DDMS- 更改基本本地调试器端口(使用 8601 而不是 8600)。
它可以工作。谢谢

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

平生欢 2024-09-07 21:42:02

我通过重新启动计算机来完成

I done it by restarting my computer

芸娘子的小脾气 2024-09-07 21:42:02

只是为了完整起见:(在 win 7/Vista 上)您不仅需要确保该行

127.0.0.1 localhost

存在,

C:\WINDOWS\system32\drivers\etc

还需要注释掉所有其他本地虚拟主机解析127.0.0.1。如果您在同一台计算机上开发 Web 内容并提前为循环回本地的不同主机名进行设置,则最有可能出现这种情况。

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

127.0.0.1 localhost

is present in

C:\WINDOWS\system32\drivers\etc

you also need to comment out all your other local virtual hosts resolving from 127.0.0.1. 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.

初见终念 2024-09-07 21:42:02

我通过仅关闭 android studio 解决了问题,以便 eclipse 可以获得 ddms

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

对风讲故事 2024-09-07 21:42:02

当我在 Ubuntu 16.04 上的 $ANDROID_HOME/tools/monitor 中执行监视器时,它显示

无法打开选定的虚拟机调试端口 (8700)。确保你不
运行 DDMS 或 eclipse 插件的另一个实例。如果
它正被其他东西使用,请在中选择一个新的端口号
偏好。

我尝试执行以下操作:

在窗口下 ->首选项->安卓-> DDMS:

将基本本地调试器端口设置为“8601”选中“使用
ADBHOST”,值应为 127.0.0.1

但它仍然弹出对话框。

然后我执行了以下操作:

gongzelong@gongzelong:~$ 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 127.0.0.1:8700          0.0.0.0:*               LISTEN      5044/java       
gongzelong@gongzelong:~$ kill -9 5044
gongzelong@gongzelong:~$ monitor

通过这样做,它解决了我的问题。

不知道为什么,但它对我有用。

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
preferences.

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 127.0.0.1

But it still pops up the dialog.

Then I did the following:

gongzelong@gongzelong:~$ 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 127.0.0.1:8700          0.0.0.0:*               LISTEN      5044/java       
gongzelong@gongzelong:~$ kill -9 5044
gongzelong@gongzelong:~$ monitor

By doing this, it solved my problem.

Do not know why, but it works for me.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文