Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

$ 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 
like image 765
Jackie Avatar asked Feb 01 '13 20:02

Jackie


People also ask

Which adb option should be used if multiple devices are connected?

If there\'s only one emulator running or only one device connected, the adb command is sent to that device by default. If multiple emulators are running and/or multiple devices are attached, you need to use the -d, -e, or -s option to specify the target device to which the command should be directed.

How do I run multiple adb shell commands?

But, in order to execute several commands in one line, you may use adb shell "cmd1;cmd2;cmd3" . The && command mentioned by @Rachit is not quite right, because in the case adb shell "netcfg && ps && getprop" , command ps will be executed only when netcfg is executed without error raised.


1 Answers

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

like image 101
janot Avatar answered Oct 12 '22 02:10

janot