[Android] 通过 Wifi 调试 adb
发布日期:2021-06-29 14:59:32 浏览次数:2 分类:技术文章

本文共 2621 字,大约阅读时间需要 8 分钟。

一、WIFI ADB 连接

手机需要有ADB 权限, 也就是通过USB线能够进入ADB, 即可。

  1. 手机 和 电脑 连接到同一个 wifi 局域网中。

    察看 手机 和 电脑的wifi 地址:
    举例如下:
    电脑: inet addr:192.168.137.40
    手机: 192.168.137.246

  2. 此时,使用 USB 线连接手机,设置手机的port 口 (默认是5555 )

    adb tcpip 5555

  3. 拔出USB 线,开始连接手机

    命令格式为:
    adb connect 手机IP[:端口号]
    adb connect 192.168.137.246 —> (可果是5555端口,可以不带port)
    在这里插入图片描述

  4. adb device 看到设备时,恭喜你,说明可以使用adb 喽。

凡事都存异常情况:

二、如果出现 “unable to connect to IP 地址:端口号”

  1. 进入 Android 设备终端中:

    $./adb shell
    $ su -
    # setprop service.adb.tcp.port 5555
    # start adbd —>重启了 Android 设备
    # adb tcpip 5555

  2. 此时拔出USB 线,建立 wifi 调试连接

    adb connect IP地址[:端口号]

三、adb 连接多台机器## 二、如果出现 “unable to connect to IP 地址:端口号”

ciellee@sh:~$ adb devicesList of devices attached 192.168.137.246:5555	deviceLHS0118723000186	device     ----> usb 线连接的第二台手机ciellee@sh:~$ adb -s LHS0118723000186 tcpip 5555     ----> usb 线连接的第二台手机, 配置端口restarting in TCP mode port: 5555ciellee@sh:~$ adb connect 192.168.137.206   ----> wifi adb 连接connected to 192.168.137.206:5555ciellee@sh:~$ adb devicesList of devices attached 192.168.137.246:5555	deviceLHS0118723000186	device192.168.137.206:5555	device------->  拔出USB线ciellee@sh:~$ adb devicesList of devices attached 192.168.137.246:5555	deviceciellee@sh:~$ adb connect 192.168.137.206connected to 192.168.137.206:5555ciellee@sh:~$ adb shellerror: more than one device and emulatorciellee@sh:~$ adb devices -lList of devices attached 192.168.137.246:5555   device product:CN_X015 model:ASUS_X015D device:ASUS_X015_1192.168.137.206:5555   device product:LYA-AL00 model:LYA_AL00 device:HWLYAciellee@sh:~$ adb -s 192.168.137.206:5555 shellHWLYA:/ #

四、断开连接

ciellee@sh:~$ adb devices -lList of devices attached 192.168.137.246:5555   device product:CN_X015 model:ASUS_X015D device:ASUS_X015_1ciellee@sh:~$ adb connect 192.168.137.206:5555 connected to 192.168.137.206:5555ciellee@sh:~$ adb devices -lList of devices attached 192.168.137.246:5555   device product:CN_X015 model:ASUS_X015D device:ASUS_X015_1192.168.137.206:5555   device product:LYA-AL00 model:LYA_AL00 device:HWLYAciellee@sh:~$ adb disconnect 192.168.137.206ciellee@sh:~$ adb devices -lList of devices attached 192.168.137.246:5555   device product:CN_X015 model:ASUS_X015D device:ASUS_X015_1ciellee@sh:~$

五、 由于目标计算机积极拒绝,无法连接。 (10061)

C:\Users\ciellee>adb connect 192.168.137.120:6666

cannot connect to 192.168.137.120:6666: 由于目标计算机积极拒绝,无法连接。 (10061)

原因为 tcp.port 不对,

可能是因为 adb tcpip 5555 不生效,

可以使用有线进入adb ,

C:\Users\ciellee>adb shellmsm8937_32go:/ # getprop | grep tcp.port[service.adb.tcp.port]: [5578]msm8937_32go:/ #msm8937_32go:/ # exitadb connect 192.168.137.120:5578
参考文章: https://developer.android.google.cn/studio/command-line/adb#wireless

转载地址:https://ciellee.blog.csdn.net/article/details/90546597 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:[ Ubuntu ] 桌面便签
下一篇:Android LCM(一)之LK_LCM点亮流程

发表评论

最新留言

不错!
[***.144.177.141]2024年04月10日 03时29分43秒

关于作者

    喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!

推荐文章