1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 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连接了。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】凌霞软件回馈社区,携手博客园推出1Panel与Halo联合会员
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步