电脑上已安装ADB,并已启用设备的USB调试。同时我已成功通过Wi-Fi连接一个设备。如何连接更多设备,而不必像这样在每个附加设备上使用-s
标志来指定设备的序列号:adb -s <serial> tcpip <port>
电脑上已安装ADB,并已启用设备的USB调试。同时我已成功通过Wi-Fi连接一个设备。如何连接更多设备,而不必像这样在每个附加设备上使用-s
标志来指定设备的序列号:adb -s <serial> tcpip <port>
是的,有一种方法可以在无需键入序列号的情况下完成此操作。
假设你有两个设备A(IP:192.168.1.32)和B(IP:192.168.1.33),你想通过WiFi连接到它们的ADB:
adb -d tcpip 5555
adb connect 192.168.1.32
adb -d tcpip 5555
adb connect 192.168.1.33
根据我的经验,Abdul Wasae的答案稍作修改。
设备A(IP:192.168.1.32)
设备B(IP:192.168.1.33)
使用USB电缆将设备A连接到计算机(但不要连接B)
adb -d tcpip 5555
adb connect 192.168.1.32
断开设备A的连接,并使用USB电缆将设备B连接到计算机,这时需要更改端口!!
adb -d tcpip 5554
在这里,您需要指定端口号
adb connect 192.168.1.33:5554
我在这里也有更详细的文档记录:通过adb连接多个设备的wifi
我很久以前就遇到了这个问题,所以我决定创建这个简单的bash脚本。
假设您已将adb
添加到路径中:
export PATH=${PATH}:/home/YOUR-USERNAME/path/to/adb
您只需要按照以下步骤进行:
Run this commands: to create your script (typically, you want $HOME/bin for storing your own scripts)
cd ~
mkdir bin
cd bin
touch adb_connect
Open and copy the script using any editor like gedit.
gedit adb_connect
And make your file executable.
sudo chmod +x adb_connect
Modify your path to add the directory where your script is located:
export PATH=$PATH:$HOME/bin
Finally, now connect your device using USB and run the script:
adb_connect
Your device must be connect now, disconnect the USB cable and repeat steps 5 and 6 to add more devices. If a successful connection occurs, it will have this output:
Connecting to LGV498bdcb2c5
restarting in TCP mode port: 7105
connected to 192.168.20.105:7105