Using the adb on the Android device

In Android 4.0, there is /system/bin/adb in Android file system.
This adb can connect to its own adbd on the device.

We need to restart adbd in TCP mode:

1     # setprop service.adb.tcp.port 5555
2 # stop adbd
3 # start adbd
4
1     # adb kill-server
2 # adb devices
3 * daemon not running. starting it now on port 5038 *
4 * daemon started successfully *
5 List of devices attached
6 emulator-5554 offline
7

Notice the device is offline. This is because in the latest Android 4.2.2, the user must first accept the host computer's RSA key to explicitly grant adb access. This message is normally displayed when you use adb to connect to the device for the first time via USB.

Refering to this reported issue: device adb connecting to localhost adbd cannot execute commands anymore since 4.2.2, we can fix the problem with:

1     # adb kill-server
2 # HOME=/data adb start-server
3 * daemon not running. starting it now on port 5038 *
4 * daemon started successfully *
5 # adb devices
6 List of devices attached
7 emulator-5554 device
8

Notes that the device's RSA key is generated in $HOME/.android , and the user can now accept the device's RSA key.

Comments

blog comments powered by Disqus