adb使用wifi无线连接调试Android设备

先上官方原文:

Wireless usage


adb is usually used over USB. However, it is also possible to use over Wi-Fi, as described here.

  1. Connect Android device and adb host computer to a common Wi-Fi network accessible to both. We have found that not all access points are suitable; you may need to use an access point whose firewall is configured properly to support adb.
  2. Connect the device with USB cable to host.
  3. Make sure adb is running in USB mode on host.
    $ adb usb
    restarting in USB mode
  4. Connect to the device over USB.
    $ adb devices
    List of devices attached
    ######## device
  5. Restart host adb in tcpip mode.
    $ adb tcpip
    restarting in TCP mode port:
  6. Find out the IP address of the Android device: Settings -> About tablet -> Status -> IP address. Remember the IP address, of the form #.#.#.#.
  7. Connect adb host to device:
    $ adb connect #.#.#.#
    connected to #.#.#.#:5555
  8. Remove USB cable from device, and confirm you can still access device:
    $ adb devices
    List of devices attached
    #.#.#.#:5555 device

You're now good to go!

If the adb connection is ever lost:

  1. Make sure that your host is still connected to the same Wi-Fi network your Android device is.
  2. Reconnect by executing the "adb connect" step again.
  3. Or if that doesn't work, reset your adb host:
    adb kill-server
    

    and then start over from the beginning.

照着原文各种问题连不上,写的简单,实际复杂啊,现总结如下

准备工作:

1.PC和手机都已连上同一个WIFI。台式没无线的可以买个无线网卡或小米WIFI。

2.用PC ping
手机,要能ping通(手机IP一般能在「设置」-「关于手机」-「状态信息」-「IP地址」找到,或者是WIFI里高级选项;也可以在PC上进入adb,输入netcfg查看)

3.用手机ping
PC,要能ping通(此步可以先略过,不行再来做)。手机ping
PC可以在手机上装个工具,我用的FPing。如果ping不通,先检查一下是不是关闭了所有的电脑管家、杀毒软件、WINDOWS自身的防火墙。

开始连接:

1.在PC的CMD中输入:adb tcpip
5555

2.断开USB连接。我就是困在这好久,不断开,按文档后面的步骤操作不了啊!

3.再次输入:adb connect 手机IP(如adb connect
192.168.1.101) 这样就OK了!

可以通过adb devices验证是否连接成功

断开链接:

在PC的CMD中输入:adb
disconnect

参考:

http://www.docin.com/p-571648854.html

http://blog.csdn.net/chychc/article/details/8673360

-------------------------------------------------------------------------------------------------------------------

2016.11.9更新

不用USB线无线连接手机

1.在Android设备上安装一个终端模拟器,如Terminal Emulator for
Android

https://github.com/jackpal/Android-Terminal-Emulator

2.打开Android设备上的终端模拟器,在里面依次运行命令:

su
setprop service.adb.tcp.port 5555

其实就是把通过USB连接中的在PC的CMD中输入:adb tcpip 5555   一个作用

其他操作就跟通过USB连接一样了
上一篇:一款堪称完美的编程字体Source Code Pro


下一篇:asp.net core web项目目录解读