Currently, when I run adb devices , it gives me a list of devices that look something like this:
emulator-5554 device emulator-5556 device
My goal is to find a command that I can run in a shell that takes a device name as a parameter, for example. Nexus7 and returns the corresponding serial number of the device, for example. emulator-5554 . If this is not possible, I want to have a function that takes emulator-5554 as a parameter and returns Nexus7 (the opposite direction of the previous function), after which I will Nexus7 over all devices in adb devices and find out which one corresponds to Nexus7 .
UPDATE
I found a workaround that should have indicated the port number when running avd, and then I know which emulator maps to which avd name, but ideally I would still like to know the answer here.
Kvass source share