运行 adb shell 在自定义设备上

Run adb shell on custom device

我通过 adb 连接了多个设备:

> adb devices
List of devices attached
FA5BBBJ01013    device
00c95491829ca2a1        device

当我尝试 运行 shell :

> adb shell

它给我错误:

error: more than one device and emulator

如何在不断开其他设备连接的情况下在自定义设备上启动 shell?

试试这个

adb -s 00c95491829ca2a1 shell

由此Documentation

如果多个 emulator/device 个实例是 运行,您必须在发出 adb 命令时指定一个目标实例。为此,请在命令中使用 -s 选项。 -s 选项的用法是:

adb -s <serialNumber> <command> 

如图所示,您使用 adb 分配的序列号为命令指定目标实例。您可以使用devices 命令获取运行 emulator/device 个实例的序列号。例如:

adb -s emulator-5556 install helloWorld.apk
adb -s < serialNumber > shell

序列号:FA5BBBJ01013 或 00c95491829ca2a1 取决于您想要的运行。

Documentation