当前位置:   article > 正文

[Android] 通过 Wifi 调试 adb_wifi adb

wifi adb

一、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 devices
List of devices attached 
192.168.137.246:5555	device
LHS0118723000186	device     ----> usb 线连接的第二台手机

ciellee@sh:~$ adb -s LHS0118723000186 tcpip 5555     ----> usb 线连接的第二台手机, 配置端口
restarting in TCP mode port: 5555

ciellee@sh:~$ adb connect 192.168.137.206   ----> wifi adb 连接
connected to 192.168.137.206:5555

ciellee@sh:~$ adb devices
List of devices attached 
192.168.137.246:5555	device
LHS0118723000186	device
192.168.137.206:5555	device


------->  拔出USB线
ciellee@sh:~$ adb devices
List of devices attached 
192.168.137.246:5555	device

ciellee@sh:~$ adb connect 192.168.137.206
connected to 192.168.137.206:5555

ciellee@sh:~$ adb shell
error: more than one device and emulator

ciellee@sh:~$ adb devices -l
List of devices attached 
192.168.137.246:5555   device product:CN_X015 model:ASUS_X015D device:ASUS_X015_1
192.168.137.206:5555   device product:LYA-AL00 model:LYA_AL00 device:HWLYA


ciellee@sh:~$ adb -s 192.168.137.206:5555 shell
HWLYA:/ # 

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38


四、断开连接

ciellee@sh:~$ adb devices -l
List of devices attached 
192.168.137.246:5555   device product:CN_X015 model:ASUS_X015D device:ASUS_X015_1

ciellee@sh:~$ adb connect 192.168.137.206:5555 
connected to 192.168.137.206:5555
ciellee@sh:~$ adb devices -l
List of devices attached 
192.168.137.246:5555   device product:CN_X015 model:ASUS_X015D device:ASUS_X015_1
192.168.137.206:5555   device product:LYA-AL00 model:LYA_AL00 device:HWLYA

ciellee@sh:~$ adb disconnect 192.168.137.206

ciellee@sh:~$ adb devices -l
List of devices attached 
192.168.137.246:5555   device product:CN_X015 model:ASUS_X015D device:ASUS_X015_1

ciellee@sh:~$ 

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19

五、 由于目标计算机积极拒绝,无法连接。 (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 shell
msm8937_32go:/ # getprop | grep tcp.port
[service.adb.tcp.port]: [5578]
msm8937_32go:/ #
msm8937_32go:/ # exit

adb connect 192.168.137.120:5578
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

参考文章: https://developer.android.google.cn/studio/command-line/adb#wireless
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/盐析白兔/article/detail/300823
推荐阅读
相关标签
  

闽ICP备14008679号