如何将 Android 模拟器附加到 ADB? [英] How to attach back the Android emulator to ADB?

查看:31
本文介绍了如何将 Android 模拟器附加到 ADB?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我通过点击 Eclipse 中的 Debug 启动模拟器后,一段时间后它与 ADB 断开连接,但模拟器保持打开状态.它是响应式的,我可以导航和启动应用程序.

After I start the emulator by hitting Debug in Eclipse, after certain time it disconnects from the ADB, but the emulator stays open. It is responsive, I can navigate and start apps.

如何将模拟器重新连接到 ADB,以便能够从 Eclipse 进行调试?

How can I attach back the emulator to ADB, to be able to debug from Eclipse?

(目前的解决方法是终止模拟器,关闭 Eclipse 并重新启动它们,这需要 10 分钟,因为您知道模拟器需要时间来启动)

(the current workaround is the terminate the emulator, close Eclipse and restart both of them, which takes 10 minutes as you know the emulator needs time to start up)

编辑 1
看看这张图片:

EDIT 1
Check out this image:

编辑 2

在我杀死并重新启动服务器之后.一个模拟器进程显示在 Eclipse 的设备选项卡中.但这无法扩展,而且我没有看到子流程.
我已经不能调试了,因为它说:调试已经在运行.(如何停止调试?)

After I kill and restart server. One emulator process shows up in Devices tab in Eclipse. But that cannot be expanded, and I don't see sub-processes.
I can't hit debug already, as it says: Debug already running. (How to I stop the debug?)

如果我设法开始调试另一个项目,它会挂在模拟器中告诉我:等待调试器附加.什么都没有发生.

If I managed to start the debugging of another project, It hangs out in the emulator telling me: Waiting for the debugger to attach. Nothing happens.

推荐答案

正如你所说,问题不是 Eclipse 与 Emulator 失去联系,而是 ADB - Android 调试桥 - 与它失去联系.由于 Eclipse 在 ADB 损坏时使用 ADB 与模拟器进行通信,因此 Eclipse 无能为力.

As you said, the problem is not Eclipse losing contact with the Emulator, but ADB - the Android Debug Bridge - losing contact with it. As Eclipse uses ADB to communicate with the emulator when ADB is broken Eclipse can do nothing.

要解决此问题停止 ADB 服务器 通过运行以下命令:

To fix this stop the ADB server by running the following command:

adb kill-server

然后Eclipse通常会尝试重启ADB,或者你可以通过运行ADB命令自己重启,比如:

Eclipse will then usually try to restart ADB, or you can restart it yourself by running an ADB command, such as:

adb devices

如果你这样做,你会看到这样的输出:

If you do, you'll see output like this:

* daemon not running. starting it now *
* daemon started successfully *
List of devices attached
emulator-5554   device

您也可以通过鼠标执行此操作,使用 Eclipse 中 Devices 视图中的 Reset adb 选项.

You can also do this via the mouse, using the Reset adb option in the Devices view in Eclipse.

另外值得注意的是,Console 视图有两种模式,DDMSAndroid.您通常处于 Console 模式,但它是 DDMS 模式,它将显示 ADB 状态消息.通过单击带有监视器图标的按钮或使用它旁边的箭头来选择模式:

It's also worth noting the Console view has two modes, DDMS and Android. You're usually in Console mode but it's DDMS mode which will show ADB status messages. Select modes by clicking the button with the Monitor icon, or using the arrow next to it:

如果一切都失败了,请尝试从操作系统中终止 adb 进程.在 Windows XP 上我使用:

If all else fails, try killing the adb processes from the OS. On Windows XP I use:

TASKKILL /F /IM adb.exe

这篇关于如何将 Android 模拟器附加到 ADB?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆