android emulator renaming from emulator-5554 to a

2020-04-15 13:18发布

问题:

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?

回答1:

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.