Skip to content

Android ADB remote debugging

This article introduces how to remote debug through adb. Three methods are introduced, which are used when the android device can and cannot be connected to the Internet.

Method 1

Start adb network listening service

adb kill-server
adb tcpip 5555

Connect to the device over the network

adb connect device_ip:5555

Then use the adb command as usual.

Method 2

In some case, the mobile phone you use for debugging cannot connect to the network or is blocked by the company’s firewall, and the device has connected to a remote host via USB. Then you can use following method.

Restart ADB service

I don’t know why the ADB service should be started like this, but if you don’t do this, you can only connect to the device from the local host instead of from a remote host.

adb kill-server
adb -a nodaemon server start &

Start adb network listening service

This step is just like method 1.

adb tcpip 5555

TCP forwarding

Forward the traffic of port 5555 of your computer to port 5555 of the device.

adb -a forward tcp:5555 tcp:5555

Connect to the device over the network

Note: The IP address below is the IP address of the remote host that is connected to the device via USB.

adb connect your_host_ip:5555

Then use the adb command as usual.

Method 3

In the case of method 2, you can also use following command to remote debugging. The ‘-H’ option of ADB can also forward your debugging commands to the remote host connected to the Android device.

adb -H remote_host_ip shell
Leave a Reply