How to use ADB Shell when Multiple Devices are connected? Fails with "error: more than one device and emulator"

Jackie picture Jackie · Feb 1, 2013 · Viewed 398.3k times · Source
$ adb --help

-s SERIAL  use device with given serial (overrides $ANDROID_SERIAL)

$ adb devices
List of devices attached 
emulator-5554   device
7f1c864e    device

$ adb shell -s 7f1c864e
error: more than one device and emulator

Answer

janot picture janot · Feb 1, 2013

Use the -s option BEFORE the command to specify the device, for example:

adb -s 7f1c864e shell

See also http://developer.android.com/tools/help/adb.html#directingcommands