How to get Android AVD name from adb device name

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".


Here it is:

> adb -s emulator-5554 emu avd name
MyDevice
OK

Tags:

Android

Adb

Avd

Adt