"Turn" Android to debug your app via WiFi

Source: Internet
Author: User

http://stormzhang.com/android/2014/08/27/adb-over-wifi/

Debugging in Android We often use a USB cable to connect to the phone and computer, on the one hand, the trouble is not to say that the phone has been attached to the computer charging time long the opponent is also a damage, on the other hand if you forget to take the USB cable is very sad. Today to teach you a way to connect the phone through WiFi to debug the method, an instant tall wood there? And you don't need root, you'll be able to install/uninstall the APK for your company's test sister.

Connection method

The method is simple and the steps are as follows:

    • 1. First make sure your phone and computer are running on the same WiFi LAN

    • 2. Because the connection is made via ADB, make sure you configure the environment variable

    • 3. The first time you need to use a mobile phone USB connection to your computer, and then run the following foreign shell script written by a successful connection will be able to unplug your USB cable, and then your computer can debug your app via WiFi.

# adbwifi.sh是脚本的文件名sh adbwifi.sh
    • 4. The above script must be OK on Mac or Linux, and Windows need to install some such as msysgit or Cygwin to run the above Linux shell

Finally remind: The actual test a series of mobile phones are OK, but the test of the hands of the two Xiaomi phone connection is not on, tragedy.

Script Content

I also created the file on GitHub gist, click here adbwifi.sh

Here is the shell content:

#!/bin/bash#Modify this with your IP rangeMy_ip_range="192\.168\.1"#You usually wouldn ' t has to modify thisPort_base=5555#List the devices on the screens for your viewing pleasureadbDevicesEcho#Find USB devices only (no emulators, genymotion or connected devicesDeclare-ADevicearray=(' ADB devices-l | GREP-V Emulator | Grep-v VBox | Grep-v "${my_ip_range}" | grep "Device" | awk ' {print '} ')Echo"Found ${#deviceArray [@]} device (s)"EchoForIndexInch${!Devicearray[*]}DoEcho"Finding IP address for device ${devicearray[index]}"IP_Address=$(adb-S${Devicearray[Index]}ShellIfconfigWlan0|Awk' {print $} ')Echo"IP address found: $IP _address"Echo"Connecting ..."adb-s ${devicearray [index]} tcpip $ (( $PORT _base +  $index adb -s ${ devicearray[index]} connect  "$IP _address:$ (($PORT _base + $index)" echo echodoneadb devices - l #exit             

"Go" Android to debug your app via WiFi

Related Article

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.