2010年5月19日 星期三

Remote debug Android by adb tool

The default Android adbd is only listened on 127.0.0.1:5037, so if the USB is not working on developing board, you can't use adb to do something.

The default setting on device, only listen 127.0.0.1:5037


# netstat      
Proto Recv-Q Send-Q Local Address          Foreign Address        State
tcp        0      0 127.0.0.1:5037         0.0.0.0:*              LISTEN
tcp        0      0 192.168.1.128:56559    74.125.47.109:993      ESTABLISHED


Following is the step to enable the remote adbd

# mv /dev/android_adb /dev/android_adb.bk
# setprop persist.service.adb.enable 1
# setprop service.adb.root 1
# setprop ctl.stop adbd
# setprop ctl.start adbd
# netstat

Proto Recv-Q Send-Q Local Address          Foreign Address        State
tcp        0      0 127.0.0.1:5037         0.0.0.0:*              LISTEN
tcp        0      0 0.0.0.0:5555           0.0.0.0:*              LISTEN
tcp        0      0 192.168.1.128:56559    74.125.47.109:993      ESTABLISHED


The Host machine which want to connect to remote Android device, you can use following command:
Ubuntu$export ADBHOST=192.168.1.128
Ubuntu$./adb kill-server
Ubuntu$./adb devices
Ubuntu$./adb shell

1 則留言:

匿名 提到...

How do you execute the following commands? Use adb shell or other way?
# mv /dev/android_adb /dev/android_adb.bk
# setprop persist.service.adb.enable 1
# setprop service.adb.root 1
# setprop ctl.stop adbd
# setprop ctl.start adbd
# netstat

When I use adb shell to execute those commands, setprop ctl.stop adbd will disconnect the adb connection, so I can not execute following commands.