下面將介紹不用USB線怎麼PC連接手機
先上官方原文:
Wireless usage
adb is usually used over USB. However, it is also possible to use over Wi-Fi, as described here.
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.
Connect the device with USB cable to host.
Make sure adb is running in USB mode on host.
$ adb usb
restarting in USB mode
Connect to the device over USB.
$ adb devices
List of devices attached
######## device
Restart host adb in tcpip mode.
$ adb tcpip 5555
restarting in TCP mode port:5555
Find out the IP address of the Android device: Settings -> About tablet -> Status -> IP address. Remember the IP address, of the form #.#.#.#.
Connect adb host to device:
$ adb connect #.#.#.#
connected to #.#.#.#:5555
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:
Make sure that your host is still connected to the same Wi-Fi network your Android device is.
Reconnect by executing the "adb connect" step again.
Or if that doesn't work, reset your adb host:
adb kill-server
and then start over from the beginning.
照著原文各種問題連不上,寫的簡單,實際複雜啊,現總結如下
準備工作:
PC和手機都已連上同一個WIFI。臺式沒無線的可以買個無線網卡或小米WIFI。
用PC ping 手機,要能ping通(手機IP一般能在「設置」-「關於手機」-「狀態信息」-「IP位址」找到,或者是WIFI裡高級選項;也可以在PC上進入adb,輸入netcfg查看)
用手機ping PC,要能ping通(此步可以先略過,不行再來做)。手機ping PC可以在手機上裝個工具,我用的FPing。如果ping不通,先檢查一下是不是關閉了所有的電腦管家、殺毒軟體、WINDOWS自身的防火牆。
開始連接:
在PC的CMD中輸入:adb tcpip 5555
斷開USB連接。我就是困在這好久,不斷開,按文檔後面的步驟操作不了啊!
再次輸入:adb connect 手機IP(如adb connect 192.168.1.101) 這樣就OK了!
可以通過adb devices驗證是否連接成功
斷開連結:
在PC的CMD中輸入:adb disconnect
上面的操作結果是脫離USB線連接手機,但剛開始還是需要有USB線連接進行設置,如果你徹底沒有USB線,也可以。
不用USB線無線連接手機
在Android設備上安裝一個終端模擬器,如Terminal Emulator for Android
https://github.com/jackpal/Android-Terminal-Emulator
打開Android設備上的終端模擬器,在裡面依次運行命令:
su setprop service.adb.tcp.port 5555
其實就是把通過USB連接中的在PC CMD中輸入:adb tcpip 5555 一個作用
其他操作就跟通過USB連接一樣了