The Android Debug Bridge

The following is primarily a note for myself, but perhaps it can be useful for others as well.

It turns out to be rather straightforward to obtain command-line access to an Android phone, also when it is not rooted. Namely, one can use ADB – the Android Debug Bridge, a client-server tool that is part of the Android SDK Platform-Tools package. It requires a working Java runtime environment and is easy to use, following the clear instructions on the ADB homepage.

For example, we can make backups of varying degrees of comprehensiveness, copy files back and forth and, moreover, we have access to the phone’s remote shell. All these operations are scriptable, too. Regarding backups, the process stalls unless I exclude .apk files, .obb files and system apps. This is not really a problem, since a command such as

$ adb backup -f backup.adb -noapk -noobb -shared -all -nosystem

completes successfully and also backs up everything from the phone’s external SD card. In this way, ADB can be very handy for salvaging data from otherwise inaccessible devices.

Once the backup is completed, it can be converted to an ordinary (t)archive using the android-backup-extractor. The .adb-file can also be restored through ADB itself.