How to Get Android Avd Name from Adb Device Name

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

What is the command to list the available avdnames

AFAIK avdmanager list avd is what you need.

Get device information (such as product, model) from adb command

The correct way to do it would be:

adb -s 123abc12 shell getprop

Which will give you a list of all available properties and their values. Once you know which property you want, you can give the name as an argument to getprop to access its value directly, like this:

adb -s 123abc12 shell getprop ro.product.model

The details in adb devices -l consist of the following three properties: ro.product.name, ro.product.model and ro.product.device.

Note that ADB shell ends lines with \r\n, which depending on your platform might or might not make it more difficult to access the exact value (e.g. instead of Nexus 7 you might get Nexus 7\r).

Android : Get device name on android tv

this is worked for my AVD (API level 24).

String deviceName = Settings.Global.getString(getContentResolver(), "device_name");

Instead of the string "device_name", you can also use the constant Settings.Global.DEVICE_NAME.


This property was moved into Settings.Global in API 17.

Before API 17, the following code should work:

String deviceName = Settings.System.getString(getContentResolver(), "device_name");

android emulator renaming from emulator-5554 to a unique string

You can't change the adb generated name, but you can change the port number.
You need to start the emulator with command line.

Go to emulator directory: ... \Android\Sdk\emulator

Use this command.

./emulator –port <port number> -avd "emulator name" <options> 

For example:

./emulator –port 5558 -avd MyEMU

In adb devices your device is now emulator-5558.

How to identify an android emulator (AVD) using ADB

Try doing a TELNET to the AVD

emulator -avd test
emulator -avd test1

avd devices

List of devices attached
emulator-5556 device
emulator-5554 device

telnet localhost 5554
Trying 127.0.0.1...
Connected to localhost.
...
OK
avd name
test1


Related Topics



Leave a reply



Submit