android adb网络连接方法

    技术2022-05-19  16

    http://hi.baidu.com/ylfan2006/blog/item/d565481a128d845543a9adeb.html

     

     

    在android里,adb一般使用USB连接,但是很多时候,可能只有一个设备终端,但是需要多于一个用户连接设备调试,因此使用网络连接将是必要的,下面介绍网络连接的方法:

    1、设备端

    首先查看设备上的进程列表,是不是adbd进程在运行:

    981 0            0 SW< [rpciod/0] 1762 0         1996 S    /system/busybox/bin/ash 1763 1000       796 S    /system/bin/servicemanager 1764 0          824 S    /system/bin/vold 1765 0          656 S    /system/bin/debuggerd 1766 1001      4396 S    /system/bin/rild 1768 1013     18084 S    /system/bin/mediaserver 1769 1002      1092 S    /system/bin/dbus-daemon --system --nofork 1770 0          784 S    /system/bin/installd 1771 1017      1616 S    /system/bin/keystore /data/misc/keystore 3798 0         3368 S    /sbin/adbd

    可以看出adbd已经在运行了,停掉adbd:

    stop adbd

    然后设置adbd使用的tcp端口:

    # setprop service.adb.tcp.port 5555

    / # start adbd

    使用netstat -l 查看:

    / # netstat -l Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address           Foreign Address         State       tcp        0      0 127.0.0.1:5037          0.0.0.0:*               LISTEN      tcp        0      0 0.0.0.0:5555            0.0.0.0:*               LISTEN

    可见adbd在5555端口已经实现监听;

    2、host端:

    ./adb connect 192.168.1.12:5555

    connected to 192.168.1.12:5555

    说明已经连接上设备;然后执行:

    ./adb shell

    就可以使用shell调试设备端的程序了


    最新回复(0)