Using ADB (Android Debug Bridge) to remotely debug apps on an Android device is a powerful tool for developers. Here’s a step-by-step guide to help you get started:
Prerequisites
- Android SDK: Ensure you have the Android SDK installed on your computer.
- USB Drivers: Install appropriate USB drivers for your Android device.
- Device Setup: Your Android device should have USB debugging enabled.
Steps
-
Enable USB Debugging on Android Device:
- Go to Settings > About phone.
- Tap Build number seven times to unlock developer options.
- Go back to Settings > Developer options.
- Enable USB debugging.
-
Connect Device via USB:
- Connect your Android device to your computer using a USB cable.
- Open a terminal or command prompt on your computer.
-
Verify Device Connection:
- Type
adb devicesin the terminal/command prompt. - If your device is listed, you’re ready to proceed. If not, ensure drivers are properly installed.
- Type
-
Set Up Port Forwarding:
- To set up port forwarding for the app you want to debug, find the local port the app uses.
- Run
adb forward tcp:<local-port> tcp:<remote-port>where<local-port>is the port on your computer and<remote-port>is the port on the Android device.
-
Connect to the Device via ADB:
- If needed, enable ADB over Wi-Fi by connecting the device to Wi-Fi and retrieving its IP address from Wi-Fi settings.
- Use the command
adb tcpip 5555to restart ADB in TCP/IP mode. - Connect using
adb connect <device-ip>:5555with your device’s IP address.
-
Debugging the Application:
- Open your IDE (like Android Studio) and attach the debugger to the application using the specified local port.
- Start debugging remotely just as you would if the device were connected directly.
Tips
- Always ensure your device and computer are on the same network if using ADB over Wi-Fi.
- To stop the ADB server, use
adb kill-server, and you can restart it withadb start-server.
Using ADB for remote debugging helps you identify issues in real-time and improves the development process, especially when physical access to the device is limited.


