连接多个设备时如何使用 ADB Shell?因“错误:多个设备和模拟器”而失败

新手上路,请多包涵
$ 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

原文由 Jackie 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 1.1k
2 个回答

根据 https://developer.android.com/studio/command-line/adb#directingcommands

什么对我的测试有用:

Ubuntu BASH 终端:

 $ adb devices
List of devices attached
646269f0    device
8a928c2 device
$ export ANDROID_SERIAL=646269f0
$ echo $ANDROID_SERIAL
646269f0
$ adb reboot bootloader

WINDOWS 命令提示符:

 $ adb devices
List of devices attached
646269f0    device
8a928c2 device
$ set ANDROID_SERIAL=646269f0
$ echo $ANDROID_SERIAL$
646269f0
$ adb reboot bootloader

这使您能够使用普通命令和脚本,就好像只连接了 ANDROID_SERIAL 设备一样。

或者,您可以每次都提及设备序列号。

 $ adb -s 646269f0 shell

原文由 zeitgeist 发布,翻译遵循 CC BY-SA 4.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题