Pairing Android Device with adb from command line
I usually pair Android Device from Android Studio, and I want to pair the device from command line, so it will be easier to connect with…
I usually pair Android Device from Android Studio, and I want to pair the device from command line, so it will be easier to connect with adb
from terminal.
I just went to another place, and the wifi is different with the one at my home, so I need to pair the device again, but I don’t want to open the Android Studio, because it is slow to run on the computer, so I want to pair the device from the command line directly, and I find that the adb
command line tool has a pair
sub command, we can use it to pair Android Device.
The help message for the adb pair
is like below:pair HOST[:PORT] [PAIRING CODE]
pair with a device for secure TCP/IP communication
On the android device, open Developer options
, and enable Wireless debugging
, then click the Pair device with pairing code
, it will show the connecting information like below:
With the information above, I can pair the device with the following command:adb pair 10.128.10.37:38159 296705