The ADB itself provides the function of network debugging, so you can use WiFi connection adbd to debug when you can't connect to Android phone directly with USB. Here's how:
Method one temporary use
If you need to use Wi-Fi only temporarily:
1. Connect the AP to the mobile phone and PC to ensure that the two can properly assign IP (ifconfig view):
Pc:
Cell phone:
(Can ping, verify interoperability, if not interoperability, please check the AP,PC, mobile phone network settings)
2. Connect the USB phone to make sure the ADB devices can find:
3. ADB tcpip 5555 (port number, can specify other values), this command will restart the phone on the ADBD, turn on the network debugging function:
4. Disconnect the phone to the PC USB connection, ADB connect 192.168.31.196:5555, prompting connected to connect successfully:
5. The ADB devices is now able to see the phones connected via TCP:
6. At this point, using the ADB shell, you have already connected to the mobile phone with WiFi:
7. Disconnect, the hand machine (or restart) will automatically disconnect the ADBD to the PC on the TCP connection, in addition, there are other methods:
A) ADB disconnect 192.168.31.120, can exit from ADB interaction and execute the command (TCP connection unblocked, interactive without Kaka);
b) open another terminal to execute the above command (at this point the ADB interaction of the other terminal automatically ends);
c) Kill the ADB on the PC, or end the ADB interaction, but will not erase the device in the ADB devices;
Method two often used
Method one need to first connect the phone via USB to the PC, using the ADB tcpip command to turn on the network debugging function, once the phone restarts, but also repeat these steps, more trouble.
Once and for all, add a line of configuration to your phone's/system/build.prop: service.adb.tcp.port=5555 (which can also be specified as a different value), enabling network debugging without first having to connect the phone to the USB.
You can pull out the/system/build.prop from your phone first, and then push it back in (requires root access):
(Note: The above adb remount command requires root)
Thereafter, after each reboot, the WiFi connection is successful (you can ping the PC) and you can use the ADB connect 192.168.31.120 to connect the phone directly.
For debugging
Using WiFi to connect to ADB and USB is not any different, you can use the ADB shell, adb logcat, adb am,adb reboot and so on, using eclipse to single-step debugging the app is no problem. No root Android phone can also be used, the only requirement is that the ADBD on the phone enabled the network debugging function, is not the evil sense of life? (other means to open the TCP debugging function of a phone)
Here's a helloworld with Eclipse and one-step debugging without any problems:
PS: Recently in tune Android USB-OTG function, mobile phone because plug in the OTG line, can not continue to connect with the USB adbd, so try the WiFi connection, experiment success, record here, convenient for future inspection.
WiFi (Network) Debug Android phone