Android | Wireless debugging using the wifi network (ADB over Wi-Fi)

In order to effectively develop Android applications, it is recommended to use a real Android device allowing some real world tests. Furthermore, physical android devices provide much more interaction possibilities like using sensor data. The standardised way to to do this is to activate the developer options and connect your device using the USB port. There is a good introduction provided by the Android documentation.

Once the development mode is activated and your phone/tablet is connected to your machine. It is recognised by your system and further through the Android Debug Bridge (adb). From this point on you can choose your device as deployment target while running or debugging your app from your IDE.

Unfortunately, it is very unsatisfying to debug an application with a connected USB cable. But for developers sake it is possible to run/debug your app using a wifi connection without a permanent connected cable. There are multiple options to do this, depending on whether your device is rooted or not. Lets start with a multi-purpose approach that should work on almost every device running Android.

Enable ADB over Wi-Fi using a computer


To use this method you have to use a command line tool on your pc to directly interact with adb. To execute the adb command you have to add the file path to the adb.exe  to your system environment variables.

Furthermore you have to know the IP address of your device in the local network. To examine it you can either visit the following menu on your phone or tablet: Settings > About > Status or execute the following command in your command line: adb shell ip -f inet addr show wlan You will receive a output like the following.
21: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
inet 192.168.0.143/24 brd 192.168.0.255 scope global wlan0

After you get the IP of your device and you are able to use the adb command you can follow this instructions to connect you device to adb over you local wi-fi.

  1. Connect the Android device to your pc using a USB cable

  2. Start your command line tool and execute the following command to restart the connection on port 5555: adb tcpip 5555

  3. Connect your adb to the device using the gathered network address by executing the following command: adb connect 192.168.0.123 Be sure to replace the IP Address that one that is actually assigned to your device.


As it can be a security risk to keep that kind of connection active I would reccomand to disable the adb over wifi connection after using adb usb.

Enable ADB over Wi-Fi from your device


As described in the xda-forum you can enable the adb over wi-fi on your device. As a precondition for this method your phone/tablet has to be rooted. If it is rooted you can execute the following commands to activate the connection:
su
setprop service.adb.tcp.port 5555
stop adbd
start adbd

To disable the connection you have to execute the following command on your device:
setprop service.adb.tcp.port -1
stop adbd
start adbd

Using a third party application


If you take a look into the Google Play Store you can find multiple apps that automate this process. As described in this Stackoverflow answer there are several apps like adbWireless, WiFi ADB and ADB WiFi. All of these require root access, but adbWireless requires fewer permissions.
{{ message }}

{{ 'Comments are closed.' | trans }}