The Android Debug Bridge, usually referred to as ADB, is a command line tool with the purpose of controlling an Android device from a computer via a USB link. The ADB command comes bundled with the Android SDK (Software Development Kit) that developers need to make apps for the platform.
You can do all sorts of things with ADB, but it’s mainly used by developers and Android users with root access who enjoy modifying their phones. ADB lets you copy files to and from your Android’s internal storage, install applications, delete preloaded apps, run commands and more.
I personally started using ADB since my rooted HTC Desire isn’t S-OFF (“security off”). Because of this, I can’t delete unwanted files on my internal storage directly from my phone with a file manager like Root Explorer — but I can do it with ADB from Recovery Mode. If you’re old enough to remember Microsoft’s command line operating system DOS that was powering PCs long before graphical user interfaces took over, you’ll feel right at home using ADB.
In order to use ADB, you need to install the Software Development Kit first. If it’s not already on your computer, please check the bottom of the post for a detailed tutorial on how to install the Android SDK – it only takes a couple of minutes.
How to use ADB
To use any ADB command, you need to connect your Android to your computer with a USB-cable, and then bring up a command prompt and navigate to the Android-SDK\tools folder. This is how you do it on Windows.
- Select Run from the Start Menu (or press Win+R) and type cmd. You change drives in the command prompt by entering the drive letter followed by a colon (:), and you change folders with the CD command. For example, to enter the Android-SDK folder, simply type cd android-sdk. To get a list of available files and folders, type dir /p.
- Once you are in the Android-SDK\tools folder, you simply type “adb” followed by the command of your choice to use the Android Debug Bridge.
- Please note that you can also add a setting in Windows that will let you use ADB from any folder. I will not cover this here, though.
How to use ADB to delete preloaded apps
- Boot into Recovery Mode. On the HTC Desire, this is done by turning off the device, then starting it by simultaneously holding the Power and Volume down buttons and selecting recovery mode from the resulting menu.
- Connect your phone to your computer with a USB-cable, open a command prompt and navigate to the folder where ADB is located.
- Mount the /system folder by typing adb shell mount /system.
- To bring up a list of the available apps, type adb shell ls /system/app.
- My custom Android ROM had the Zeam launcher preinstalled but I don’t use it, so I will remove Zeam in this example. To delete Zeam, I just type adb shell rm /system/app/Zeam.apk. Please note that the filenames are case sensitive, so you need to enter the names exactly as they’re written in the list.
How to copy apps to and from your phone with ADB
If you don’t want to completely delete a preinstalled app on your internal storage, you can copy it to your SD card first so you’ll have a backup. Follow the initial four steps in the tutorial above, and then type this:
- adb shell mount /sdcard – this will mount your memory card
- adb shell mkdir /sdcard/foldername – this creates a folder on your SD card with the name of your choice. If you already know a folder you want to copy the app to, skip this step.
- adb pull /system/app/AppName.apk /sdcard/foldername – copies the app to the folder on your SD card that you specify.
- I typed adb pull /system/app/Zeam.apk /sdcard/Test to copy the Zeam launcher to a folder called ”Test” on my memory card.
To copy, or push, a file to your internal storage, you can use the push command. In this example, I install a new boot animation by pushing the file bootanimation.zip located in the android-SDK/tools folder on my computer to my rooted Android phone’s internal storage.
adb shell mount /system – mounts the system folder
adb shell rm /system/media/bootanimation.zip – removes the current boot animation
adb push bootanimation.zip /system/media – copies the new bootanimation.zip to my phone
adb reboot – reboots my device
How to install the Android SDK on your PC
- First you have to enable USB debugging on your Android phone from Settings > Applications > Development > USB debugging.
- Install the Android SDK on your computer from http://developer.android.com/sdk/. Once you’ve downloaded and extracted the package, run SDK Setup.exe and click on Available Packages to the left. If you get an error message at this point, enable “Force https://…” in the Settings. From the list of available packages, select “Usb Driver package”, click on the Install Selected button in the bottom right corner and follow the prompts.
- Connect your phone to your computer with your USB-cable. Your OS will prompt you to install new drivers. Choose to install them from the android-sdk/usb_driver folder. Do not mount your device, you just need to plug-in the cable.
- That’s it! ADB is located in the android-sdk/tools folder.
You can read more about ADB at Google’s official developer site.