DEV Community

David Okonji
David Okonji

Posted on

Remote Debugging for Android Devices

While working on android applications development, it is a common practice to debug apps using a USB cable to connect the device to android studio. With the decreasing number of computer's ports, for which we require an external dongle device to connect USB cables. By using remote debugging, it saves a lot of time and space needed to carry external accessories used to debug a mobile application on an android device.

A couple years back I wrote an article on Remote Debugging in React Native which was majorly focused on using Xcode to connect to IOS devices remotely, at that time remote debugging option was not available for android studio.

In this article, I will be explaining how to set up remote debugging for an android application over the network using Android Studio and an Android device.

Note: This is not limited to testing a native android application but also for react native and flutter applications.

Required Tools

Steps to setup

Now, we have all tools setup, we can go ahead to open our android project in android studio and follow the steps below;

On the android test device

We should ensure the Developer Options is enabled, In developer options, an option for Wireless debugging should be toggled off by default, it should be toggled on

Android wireless debugging on

Tapping on the enabled wireless debugging should get you options to connect wirelessly

Android wireless debugging options

In android studio

We should click on the dropdown to select a device at the top right menu bar,

Android Device selection

That should give a pop up dialog which give a default option to Pair using QR code

-> Pairing using QR code

Pairing using QR code
On the mobile device already been setup above, we click on the option to Pair device with QR code which gives a QR scanner screen to scan the QR generated by android studio

Scan Android QR

Once scanned correctly, we get a successfully paired status and would see the new paired devices under the list

Successfully paired

-> Pairing using pairing code
On the mobile device already been setup above, we click on the option to Pair device with pairing code to generate a pairing code which would be used to finish the pairing set up.

Pairing using pairing code start

In android studio we should toggle the Pair using pairing code option in the popup dialog, we should see our device ready to start pairing

Start Pairing

Input the code generated on the mobile phone into the fields on android studio

Code input

Once scanned correctly, we get a successfully paired status and would see the new paired devices under the list

Successful

Either ways we go about pairing the device, once done we should see our device available for the app to run on anytime we are connected to the same network πŸŽ‰

Run on device

Debugging issues

  • Can't see developer options? How to toggle developer options on a new device: Go to phone settings -> Scroll to the bottom and click on the about phone option -> Click on software information -> Tap on the Build number 7 times to get a prompt that developer options has been enabled.
  • Can't see device to pair with? Confirm if the android device and system running the android studio are on the connected to same network.

Conclusion

Using remote debugging generally saves a lot of time to debug mobile applications, Hopefully it would save yours.

Thanks for reading πŸ₯³

Top comments (4)

Collapse
 
paulharshit profile image
Harshit Paul • Edited

This article is an excellent resource for anyone looking to delve into the world of debugging web issues on Android. I stumbled upon a similar blog post that provides valuable insights on the topic, and I wanted to share it with everyone. You can find it at the following link: lambdatest.com/blog/a-detailed-gui.... Happy reading!

Collapse
 
pierratono profile image
Pierratono Costa MAHORO

That's awesome, Before release of this feature I was using ADB WiFi but this one makes everthing easier than ADB WiFi Option.

Collapse
 
davidokonji profile image
David Okonji

That’s awesome, it reduces the need for extra tools

Collapse
 
nwamugo profile image
UGOJI Duziem

Thank you. While debugging ionic apps, I used remote debugging and appreciated how much faster and convenient it was.