Supercharge Your Android Remote Debugging Experience with Ngrok

Gegham Simonyan
Picsart Engineering
4 min readMay 22, 2023
Image generated by AI

As Android developers, we constantly look for ways to improve our workflow and efficiency. And debugging is an essential part of the app development process. It allows us to identify and fix issues in the code, ensuring that the application runs smoothly. However, debugging can become challenging when you need to debug an Android application remotely, especially when you are in different countries or locations. Fortunately, there is a way to supercharge the Android remote debugging experience using ADB (Android Debug Bridge) and Ngrok. In this article, we will explore how this method can help developers fasten the process of remote debugging and provide step-by-step instructions on how to do it.

Why Use Ngrok with ADB for Remote Debugging?

  • Convenience: Ngrok is a simple and easy-to-use tool that creates secure tunnels to expose local servers over the internet. By combining ADB and Ngrok, you can conveniently debug your Android app remotely without the need for complex setups or port forwarding.
  • Flexibility: Flexibility to debug Android apps from anywhere in the world. Whether you are working in a different country or a remote location, you can connect to your Android device or emulator using ADB and expose the debugging port over the internet with Ngrok. This makes it possible to collaborate with team members located in different regions or test your app on devices in different locations, making the debugging process more efficient.
  • Security: ADB uses encrypted connections between your computer and the Android device or emulator, ensuring your debugging data is safe from interception. Ngrok creates secure tunnels using HTTPS, protecting your data from unauthorized access. This makes it safe to debug your Android app remotely without exposing your device or app to security risks. Moreover, by default, ADB uses an unencrypted connection for convenience and ease of use in development environments.

However, when dealing with sensitive data or in production environments, it’s recommended to enable ADB over TLS/SSL to ensure the confidentiality and integrity of the communication.

Preparing the Environment

Step 1: Install Ngrok on your computer

  • Sign up for a free account on the Ngrok website (https://ngrok.com/).
  • Download the Ngrok client for your operating system and follow the installation instructions.

Step 2: Install ADB on your computer

  • Download and install the Android SDK Platform Tools, which includes ADB, on your computer.
  • Set up the ADB environment variables, if necessary, to access ADB from any location on your computer.

Step 3: Setting Up Your Device for Remote Debugging

With the environment ready, it’s time to prepare your device for the magic of remote debugging.

  • Disconnect from any VPNs.
  • Turn on the “USB Debugging” option on your Android device.
  • Connect your Android device to your computer via a USB cable.

In the Terminal, type adb devices. You should see your device’s serial number (accept any trust notification on the device if prompted):

adb devices
Example output
  • Enter the following command in the terminal:
adb tcpip 5555
example adb tcpip 555 output
  • Now, you can disconnect the device from your laptop.

Important !! Keep the device connected to the same WiFi network as your laptop.

  • Go to your mobile device and obtain its IP address from the Wi-Fi settings.
  • Open macOS Terminal and write.
ngrok tcp $YOUR_MOBILE_DEVICE_IP_ADDRESS:5555
  • Share Your forwarding address with the developer.

Important !! Keep an eye out for any pop-up notifications requesting permission to connect.

Step 4: Remote Connection To Android Device

Developer can easily access to android device via Ngrok address

adb connect $NGROK_ADDRESS

Conclusion

Setting up your device for remote debugging can significantly enhance your development workflow and increase collaboration opportunities with other developers. With remote debugging, you can debug code on a remote device from anywhere worldwide, making teamwork more efficient and enjoyable. By embracing this powerful technique, you can supercharge your Android debugging experience and increase productivity. So, start exploring the future of collaboration and remote debugging with Android today!

--

--