7

So when on starting up an emulator , adb devices give me

emulator-5554 device

All dandy till here.

What i am envisioning is to create an emulator farm with multiple emulators spawned up on multiple devices. In order to uniquely differentiate from an emulator-5554 running on machine A from emulator-5554 running on machine B ,I would like to rename emulator-5554(s) to something like machineA-emulator-5554 and machineB-emulator-5554. Searching around did not find me much help ( as a majority of the questions were regarding actual device renaming). Any pointers on the above?

NP:I had tried to do a setprop on serialno with a random string and then checked to see whether it actually changed ( and it had)

root@generic_x86:/ # getprop persist.usb.serialno

76876987gg

Weirdly running adb devices gave me a status of

emulator-5554 offline

The emulator name did not change and the status went offline. Am i missing something here?

Community
  • 1
  • 1
Kriskros
  • 150
  • 1
  • 9

2 Answers2

6

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.

Alex P.
  • 30,437
  • 17
  • 118
  • 169
Mr.Head3437
  • 156
  • 2
  • 4
5

adb server scans range of TCP ports and when it finds something listening on those ports it registers it as a device with the emulator-XXXX name. No configuration of the device itself can change that. You could either modify the adb code to implement your custom naming scheme or just use some other facility to identify your emulator instances.

Alex P.
  • 30,437
  • 17
  • 118
  • 169
  • Oh so is it an " emulator-only" thing ? I had come across posts which dealt with topics around renaming the device( physical devices) id names shown through adb devices. [link to the post](http://stackoverflow.com/questions/9786928/how-can-i-change-the-device-name-adb-devices) – Kriskros Mar 01 '17 at 19:18