file: system/core/adb/adb.c line: 921 /* for the device, start the usb transport if the ** android usb device exists and "service.adb.tcp" ** is not set, otherwise start the network transport. */ property_get("service.adb.tcp.port", value, "0"); if (sscanf(value, "%d", &port) == 1 && port > 0) { // listen on TCP port specified by service.adb.tcp.port property local_init(port); } else if (access("/dev/android_adb", F_OK) == 0) { // listen on USB usb_init(); } else { // listen on default port local_init(ADB_LOCAL_TRANSPORT_PORT); }
根据上面的代码, 执行以下命令
stop adbd
setprop service.adb.tcp.port 5555
start adbd
便能开启网络调试的端口,PC端执行
adb connect <host>[:<prot>]
即可使用tcp协议连接Andorid设备。
putty连接Android设备
Android设备需要安装一个SSH Server软件,建议SSHDroid,https://apkpure.com/cn/sshdroid/berserker.android.apps.sshdroid
然后就可以通过putty连接了。