Querying for Android Emulator/Device Instances

 Before issuing adb commands, it is helpful to know what emulator/device instances are connected to the adb server. You can generate a list of attached emulators/devices using the devices command:

adb devices

In response, adb prints this status information for each instance:
  • Serial number — A string created by adb to uniquely identify an emulator/device instance by its console port number. The format of the serial number is -. Here's an example serial number: emulator-5554
  • State — The connection state of the instance. Three states are supported:
    • offline — the instance is not connected to adb or is not responding.
    • device — the instance is now connected to the adb server. Note that this state does not imply that the Android system is fully booted and operational, since the instance connects to adb while the system is still booting. However, after boot-up, this is the normal operational state of an emulator/device instance.
The output for each instance is formatted like this:
[serialNumber] [state]



Here's an example showing the devices command and its output:

$ adb devicesList of devices attached 
emulator-5554  device
emulator-5556  device
emulator-5558  device

No comments:

Post a Comment