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:
02 | [497][nicholasdunn: /Users/nicholasdunn]$ adb devices |
03 | List of devices attached |
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 * |
12 | [500][nicholasdunn: /Users/nicholasdunn]$ adb devices |
13 | List of devices attached |
17 | [501][nicholasdunn: /Users/nicholasdunn]$ adb devices |
18 | List of devices attached |
If this happens to you frequently (it does to me), you can create an alias within your .bash_profile file (~/.bash_profile):
1 | alias adb-restart= 'adb kill-server; adb start-server; adb devices; adb devices' |
Reload your .bash_profile file:
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:
Post a Comment