Auto-generate Flow Chart from Java/C++ Codes:

Raptor Flowchart Tutorial For Beginners

Wednesday, June 27, 2012

Eclipse could not detect Android Emulator

From: http://developmentality.wordpress.com/2010/09/13/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:
01# Device is running but not showing up
02[497][nicholasdunn: /Users/nicholasdunn]$ adb devices
03List of devices attached
04 
05# Kill and restart
06[498][nicholasdunn: /Users/nicholasdunn]$ adb kill-server
07[499][nicholasdunn: /Users/nicholasdunn]$ adb start-server
08* daemon not running. starting it now *
09* daemon started successfully *
10 
11# Device appears, but is listed as offline
12[500][nicholasdunn: /Users/nicholasdunn]$ adb devices
13List of devices attached
14emulator-5554    offline
15 
16# One more invocation of adb devices should get it recognized
17[501][nicholasdunn: /Users/nicholasdunn]$ adb devices
18List of devices attached
19emulator-5554    device
If this happens to you frequently (it does to me), you can create an alias within your .bash_profile file (~/.bash_profile):
1alias adb-restart='adb kill-server; adb start-server; adb devices; adb devices'
Reload your .bash_profile file:
1source ~/.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.

No comments: