9.1 ADB Android Debug Bridge

20200121

The Android Debug Bridge is an application that runs on a computer to communicate with a USB connected Android device. Begin by changing settings on the Android device, under Developer options, to enable USB debugging. Then connect the device and click OK on the popup seeking permission for remote access. If in the device listing below it says unauthorised instead of device then the popup on the device has probably not provided the right permissions. Sometimes re-plugging the device will do the trick to show the popup on the device.

On Ubuntu install the command line application:

$ wajig install adb
$ adb devices
List of devices attached
bf0546056101270a02  device

Start up a shell running on the Android device connected via a daemon which is started up if it is not already running:

$ adb shell

Common GNU/Linux shell commands can now be utilised to navigate the device’s operating system.

lynx:/ $ ls
[...]
1|lynx:/ $ cd storage/emulated/0
[...]
lynx:/storage/emulated/0 $ ls
[...]

Here, lynx is the code name for the Samsung Galaxy S7.

Type Ctrl-d or the exit command to exit from the shell.

If the daemon is not running it will automatically start up with the message:

* daemon not running; starting now at tcp:5037
* daemon started successfully

In the following circumstance, do as suggested—check for the confirmation dialog on the device:

$ adb shell
error: device unauthorized.
This adb server's $ADB_VENDOR_KEYS is not set
Try 'adb kill-server' if that seems wrong.
Otherwise check for a confirmation dialog on your device.

If your device is not listed then try using an alternative USB cable, which oddly enough can be the problem. This may be because a Samsung cable is required (?) or the old USB cable is functional enough for charging but not communicating.

If your device is not rooted you will be limited in what you can access.

See https://developer.android.com/studio/command-line/adb for details of using ADB.



Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0