Android_adb_ debug via WiFi or USB

Source: Internet
Author: User

this blog post for the original, reproduced please specify the source! http://blog.csdn.net/zimo2013/article/details/395521291. Introduction

By default, ADB is connected via USB, but ADB also supports WiFi connections, provided that the computer terminal using the ADB command is under the same network segment as the phone being debugged. This allows you to debug your phone without USB or remote. But when the phone's debug mode changes to WiFi, the phone connection to USB will not work, including charging. The phone can be cut back to USB under WiFi.

2. Connect the USB cable to WiFi (if ADB is connected via USB)
CMD:ADB TCPIP 5555//Can disconnect the USB cable, you will find that the USB charging is not displayed, the connection cable is invalid. Connect wificmd:adb connect Android device IP address (eg: adb connect 192.168.43.144)//Disconnect wificmd:adb Disconnect

3.WIIF to USB (pre-adb wifi connection)
CMD:ADB usb//the USB cable can be used normally at this time.

4.adb no connection to WiFi
Need to get super Admin privileges to execute Su, and then perform SetProp service.adb.tcp.port 5555stop adbdstart adbd//connect wificmd:adb connect Android device IP address (e.g.: adb Connect 192.168.43.144)

5.adb no connection to USB
Need to get super Admin privileges to execute Su, then execute setprop service.adb.tcp.port-1stop adbdstart adbd

6. Script switching

Create a new file named adbtowifi.sh

#!/bin/bash #Modify this with your IP rangemy_ip_range= "192\.168\.43" #You usually Wouldn ' t has to modify thisport_base=5555#list the devices on the screens for your viewing pleasureadb devicesecho#find US B devices only (no emulators, genymotion or connected devicesdeclare-a devicearray= (' adb devices-l | grep-v Emulator | Grep-v VBox | Grep-v "${my_ip_range}" | grep "Device" |  awk ' {print '} ') echo "found ${#deviceArray [@]} device (s)" Echofor index in ${!devicearray[*]}doecho "Finding IP Address For device ${devicearray[index]} "ip_address=$ (Adb-s ${devicearray[index]} shell ifconfig wlan0 | awk ' {print $} ') echo" IP address found: $IP _address "echo" Connecting ... "Adb-s ${devicearray[index]} TCPIP $ (($PORT _base + $index)) Adb-s ${de Vicearray[index] "Connect" $IP _address:$ (($PORT _base + $index)) "Echoechodoneadb Devices-l#exit 
The above script files, Mac or Linux directly can run, Windows need to install some such as msysgit or Cygwin to run above Linux shell//premise need USB connection adb, after playing command, you can unplug the USB cable, When the phone is switched to the WiFi connection, after connecting to the WiFi, such as switching back to USB, using ADB USB or restarting the device can be SH adbtowifi.sh

Android_adb_ debug via WiFi or USB

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.