Querying for 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 <type>-<consolePort>. Here's an example serial number:

emulator-555 4

• State — The connection state of the instance. Three states are supported:

o offline — the instance is not connected to adb or is not responding.

o 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 devices List of devices attached emulator-5554 device emulator-5556 device emulator-5558 device

If there is no emulator/device running, adb returns no device.

0 0

Post a comment