GNU/Linux Desktop Survival Guide
by Graham Williams |
|||||
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.
herolte:/ $ ls [...] 1|herolte:/ $ cd storage/emulated/0 [...] herolte:/storage/emulated/0 $ ls [...] |
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.