sudo apt-get install android-tools-adb
adb devices # 确认设备在线(显示序列号)
adb tcpip 5555 # 切换 ADB 到 TCP 模式,监听 5555 端口
# 如果当前显示设备序列号,通过以下方式切换模式
adb -s F409659900017 tcpip 5555
adb devices # 获取设备号
adb -s 设备号 shell ip addr show eth0
// 例如 adb -s F409659900017 shell ip addr show eth0
adb connect ip:5555
注意:设备重启后,ADB 会恢复为 USB 模式,每次重启后需重新执行 adb tcpip 5555
Android11 及以上推荐使用配对的方式
adb pair ip:port
adb connect ip:port
很多 RK3566 设备 已内置 persist.adb.tcp.port 支持,只需一条命令即可永久开启 ADB over TCP。
adb shell # 进入设备命令环境
// 如果有多台设备
adb -s 设备号 shell // 例如 adb -s F409659900017 shell
// 查看设备号
// adb devices
setprop persist.adb.tcp.port 5555
setprop service.adb.tcp.port 5555
// 以下这两个命令可能不生效,但是不影响
stop adbd
start adbd
reboot
adb connect ip:5555
adb -s ip:port shell pm list packages
adb -s ip:port shell cmd package resolve-activity --brief 包名