Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get Android AVD name from adb device name

Tags:

android

adb

avd

adt

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)?

like image 210
Micah Carrick Avatar asked Dec 05 '11 07:12

Micah Carrick


People also ask

How do I find my adb device name?

You can now connect your device with USB. You can verify that your device is connected by executing adb devices from the android_sdk /platform-tools/ directory. If connected, you'll see the device name listed as a "device." Note: When you connect a device running Android 4.2.

How do I change my device name adb?

In android go to Settings > Applications > Development and tap on Device Hostname. You can then change the name and it should show up when attached to adb.


2 Answers

Here it is:

> adb -s emulator-5554 emu avd name MyDevice OK 
like image 170
Dmitry Avatar answered Oct 18 '22 04:10

Dmitry


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

like image 45
Alexander Lucas Avatar answered Oct 18 '22 03:10

Alexander Lucas