30

Using the Android SDK from the command line, I can get a list of the running devices available using:

./adb device

This gives me the serial number of available devices. How can I get the AVD name of the emulator device from that serial number (like the Eclipse ADT plugin does)?

Alex P.
  • 30,437
  • 17
  • 118
  • 169
Micah Carrick
  • 9,967
  • 3
  • 31
  • 43

3 Answers3

36

Here it is:

> adb -s emulator-5554 emu avd name
MyDevice
OK
Dmitry
  • 664
  • 8
  • 8
24

The Eclipse plugin does it by connecting to the emulator via tcp/ip. To connect, (for linux), type

~/code$ telnet localhost 5554
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Android Console: type 'help' for a list of commands
OK

Replace "5554" with whatever number comes after the hyphen when you type "adb devices" - "emulator-5554", for instance, would have telnet port 5554 open.

Then, type "avd name", hit enter, and you should see something similar to the following:

avd name
GB10
OK

In this example the emulator's name was "GB10".

Alexander Lucas
  • 22,171
  • 3
  • 46
  • 43
0

Using adb devices you can see the List of devices attached.

In my case the result is:

List of devices attached
emulator-5554   device
cigien
  • 57,834
  • 11
  • 73
  • 112
Rodrigo Ibarra
  • 147
  • 1
  • 1
  • 8