Search code examples
androidandroid-emulatoradb

android emulator renaming from emulator-5554 to a unique string


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?


Solution

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