Wednesday, July 2, 2025

【Android】複數台裝置 adb 指定連線特定台裝置

只連接單一台 Andorid Device 時,adb 的指令下法很單純。但當有複數台裝置時,指令的下法該如何使用?

 

指定裝置

當連接到多台 Android 裝置時,直接下 adb shell 會出現

error: more than one device/emulator

意即 adb 無法知道使用者希望對哪台裝置進行控制,這時候可以透過參數 -s 去指定裝置,就可以達到對特定裝置下指令的目的。例如先查詢有哪些裝置

$ adb devices
List of devices attached
10.108.2.10:1234 device
10.108.2.11:2436 device

則指定裝置的做法如下:

$ adb -s 10.108.2.10:1234 shell

即對裝置 10.108.2.10:1234 進入 shell。

 

參考資料 | Reference
  1. android - adb more than one device/emulator, stack overflow, 2018

No comments:

Post a Comment

熱門文章