I'm Andrew Hoefling, and I work for FileOnQ as a Lead Software Engineer building mobile technologies for Government, Financial and First Responders using Xamarin. 

 

Android Wi-Fi Debugging with ADB and Xamarin Visual Studio


Debugging an Android App over wifi opens up new scenarios that you can't simulate with an emulator or connected device via USB. If you are like me and have custom hardware that requires a large charging cradle, it makes it even harder to test a device in your hand. See my blog about the Zebra TC70x which shows you the kind of device I am currently working with.

Until recently I thought you needed a rooted device to configure the wifi debugging on an Android device.

Rooted Device

If you have a rooted device it is super simple to set up wifi debugging, just open up the terminal emulator on the device and run the following command:

Configure Device

su
setprop service.adb.tcp.port 5555
stop adbd
start adbd

Once the tcpip port is opened, you just need to open up the ADB Console on the machine you wish to debug from, then connect to your device. On the device open up the network settings to get the IP address of the device. In my example the IP address is 192.168.1.123

Connect

adb connect 192.168.1.123:5555

At this point you can start debugging over wifi

Regular Device

Most of the time you have a regular device that is not rooted and if you want to setup wifi debugging you just have more steps, the process is still very much the same.

Configuration

  • Device is connected to your machine
  • USB Debugging is turned on, and the device allows the machine to connect
  • ADB installed correctly, and the device is recgonized. Use adb devices to see list of connected devices

If all the steps in the Configuration above are met you are ready to turn on wifi debugging. Start by opening up a terminal/console/command prompt that has access to ADB. Execute the following command

adb tcpip 5556

This command updates the device to listen for ADB connections on the specified port of 5556. 

Afterwards the screen may flash asking to allow debugging, just hit cancel as it is trying to re-authenticate with the USB Connection. Disconnect the device from the machine and make sure it is connected to the same network over wifi.

Using the network configuration on the device determine the IP address, you should be able to easily access this information from the wifi settings. For this example our IP address is 192.168.1.123.

On the computer in your terminal/console/command prompt with ADB, execute the following command

adb connect 192.168.1.123:5556

The device will prompt you for USB Debugging access, accept it and you can start debugging.

That's it! Not too complicated, now you can enjoy debugging over wifi and test scenarios that may not be apparant while connected to the machine directly.

 

-Happy Coding


Share

Tags

AndroidDebugADBWiFi