Home > Android, Uncategorized > Android – disappearing emulator ? Restart adb server

Android – disappearing emulator ? Restart adb server

While developing for the Android platform has gotten a lot better in the past year, there are still some rough edges.  In particular, emulators sometimes disappear from the list of attached devices (accessed via adb devices from the terminal, or within the Devices tab when in DDMS view in the Eclipse plugin).  When this happens, you cannot interact with it via the terminal or Eclipse.  That’s a pretty big problem.

A screen shot illustrating a running emulator that does not appear in the list of attached devices

An emulator within the devices window

To solve this, you should take the following steps:

# Device is running but not showing up
[497][nicholasdunn: /Users/nicholasdunn]$ adb devices
List of devices attached

# Kill and restart
[498][nicholasdunn: /Users/nicholasdunn]$ adb kill-server
[499][nicholasdunn: /Users/nicholasdunn]$ adb start-server
* daemon not running. starting it now *
* daemon started successfully *

# Device appears, but is listed as offline
[500][nicholasdunn: /Users/nicholasdunn]$ adb devices
List of devices attached
emulator-5554    offline

# One more invocation of adb devices should get it recognized
[501][nicholasdunn: /Users/nicholasdunn]$ adb devices
List of devices attached
emulator-5554    device

If this happens to you frequently (it does to me), you can create an alias within your .bash_profile file (~/.bash_profile):

alias adb-restart='adb kill-server; adb start-server; adb devices; adb devices'

Reload your .bash_profile file:

source ~/.bash_profile

You can then invoke it from the terminal by typing adb-restart.  Sometimes one invocation of adb devices is enough to have the emulator show up as a device; others requires two.  Not sure why that is.  To be safe I’m including two in the script.

  1. Jack
    September 23, 2010 at 9:21 am

    Can you tell me where I can get the emulator for the G1
    or the one shown?

    Thank you

    • i82much
      September 23, 2010 at 6:54 pm

      The emulator tool is bundled with the Android SDK. The one you see in the screenshot is from 1.6. If you run at level 1.5, you’ll see the Red G1 emulator skin.

      There are ways to install other skins on the emulator as well, but I’ve never done that.

  2. Rick
    October 6, 2010 at 9:24 pm

    Thank you. Just restarting the adb was enough for me!

    • i82much
      October 8, 2010 at 10:57 pm

      Great, glad it worked out for you

  3. February 16, 2011 at 12:45 pm

    nice hint, thanks for helping me out!

  4. justanotherdev
    November 1, 2011 at 7:22 pm

    This is a very useful tip! Thanks a lot.

  5. December 16, 2011 at 11:04 am

    Thanks a million. Saved me countless minutes (hours!) closing the emaulator down and restarting it!

  6. Somebody
    April 16, 2012 at 11:25 am

    In case any Windows users like me find this post in search of a way to get the emulator running properly (in my case Windows 7, 64bit with 64bit Eclipse and Java):

    Start your program, then switch to the DDMS perspective (top right of the screen, if it’s not there, click “open perspective” first), on the “Devices” tab, click the little arrow on the right side and then “Reset adb” while your emulator is loading up.
    It will appear in the devices list a couple of seconds later and work as intended.

  7. Keshav Agrawal
    June 11, 2012 at 7:20 pm

    even if i restart the server and then execute adb devices then also i get empty list! what to do ?

  8. itay
    February 15, 2013 at 5:45 am

    I didnt understand where to write the commands….please help!

    • Nicholas Dunn
      February 15, 2013 at 7:17 am

      From the terminal on a unix machine. If you have windows you might need Cygwin

  9. April 2, 2013 at 4:07 am

    oh man Thank you so much for this great post! you save my time, and now i can see my emulator appear (attached) on the tab of DDMS. Thx again

  1. August 14, 2021 at 6:33 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: