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 5555
    restarting in TCP mode port:5555
    
  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連接一樣了

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

關注微信公眾號(測試工程師小站)即可在手機上查閱,並可接收更多測試分享,發送【測試資料】更可獲取百G測試教程~



免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM