How to attach back the Android emulator to ADB?

44,456

Solution 1

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.

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

adb kill-server

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

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

alt text

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:

alt text

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

TASKKILL /F /IM adb.exe

Solution 2

There is an easier way. From eclipse you can reset the adb from DDMS panel. Here's a short video on doing that "Reset ADB on DDMS"

Here's a quick screenshot of where you can get the option.enter image description here

Solution 3

on a mac, i just had to kill adb from activity manager and manually re-open the program again. had eclipse open all through and it worked just fine.

Solution 4

Sometimes a kill-server won't help at my machine (WinXP). For example I can't see the emulator in the DDMS-View any more or I do see it but no processes running on it.

In these cases I close the emulator and eclipse and manually kill the adb.exe-process from the process list.

When I then restart eclipse and the emulator, everything's fine again.

Now I just need a keyboard-shortcut for that :-)

Share:
44,456
Pentium10
Author by

Pentium10

Backend engineer, team leader, Google Developer Expert in Cloud, scalability, APIs, BigQuery, mentor, consultant. To contact: message me under my username at gm ail https://kodokmarton.com

Updated on November 26, 2020

Comments

  • Pentium10
    Pentium10 over 3 years

    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.

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

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

    EDIT 1
    Check out this image:

    enter image description here

    EDIT 2

    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.

  • Pentium10
    Pentium10 over 14 years
    I can't do this via the mouse, using the Reset adb option in the Devices view in Eclipse because all what is there is grayed out. Check my edit above.
  • David Webb
    David Webb over 14 years
    @Pentium10 - try killing the adb processes from the OS as this helps sometimes. Next try restarting Eclipse, which for me, is quicker than restarting the Emulator.
  • Tushar
    Tushar about 13 years
    for me In recent with this honeycomb update it looks like emulator does not appear even if all these steps of adb restarting are performed.
  • Nick White
    Nick White over 10 years
    Two notes: adb for me is in adt-bundle-.../sdk/partner-tools and I had to do both adb kill-server and adb start-server. Eclipse did not start it for me.
  • Darpan
    Darpan almost 10 years
    I did it but it did not connect my emulator back to ADB.