Android Debug Bridge, often abbreviated as ADB, is a command line utility for communicating with any connected Android Device or any instance of Android Virtual Device. It is a tool that is specially used by developers who need to communicate with their device the most from computers for various purposes including that of testing a developed app, viewing log cat, accessing system files of an android devices, etc.
ADB is very useful tool for both developers and other android users as well. Developers can access ADB from the platform-tools folder within their Android SDK installation directory while other can download ADB from here. Since, it is a command line tool user must know how to use the command prompt. There are two ways to get started with using ADB. One is to navigate to the folder which contains adb.exe and then issue/run commands and other set the path to the folder that contains ADB in Environment Variables and then run ADB from any directory in the command prompt. You can set the PATH by following these simple steps:
1. Extract ADB to a location and get the path of the directory that contains adb.exe . If you extracted to ADB folder in D: drive then your path will be D:\ADB.
2. Right Click on Computer icon on desktop and then select Properties.
3. On the right sidebar in properties window click Advance System Settings.
4. Navigate to Advance tab and then click Environment Variables at the bottom of the System Properties window.
5. Select any User Variable and then look for Path variable in the System variable (just below user variable). See figure below for reference.
6. After selecting Path variable, click on Edit button and then in the Edit System Variable window leave Variable name as Path and then in Variable values go to the end of the text and then put a semicolon (;) and then type or paste your path from above. In our case add ;D:\ADB at the end of the Variable values field. Make sure you don’t remove the paths that are already there. If you remove them your system might become unstable. In simple terms, just append your ADB path in the Variable value field.
7. Press Ok and then close any remaining windows.
|Environment Variable Settings.|
7. Press Ok and then close any remaining windows.
Now, you are ready to use ADB from any directory in the command prompt. Just open the command and then type adb help to list useful adb commands and help file. Now, you can install applications or games, view log cat, even use adb shell command to issue command to any of your connected android devices. ADB Shell lets you run Linux commands just like you do with terminal emulator or shell commander. The only difference is you will get large screen to view and large keyboard to type commands. The most important thing to remember is to enable USB Debugging on your device or else ADB won’t work. To enable USB Debugging go to Settings>Applications>>Development and then check USB Debugging option.
Here are some frequently asked questions and their answers.
Q. How do I install applications using ADB?
A. Either run adb install
command. To do so copy the app to the directory that contains adb.exe otherwise use full path to your application instead of app name.
Also, if you downloaded the zip from above you will find a Drag and Drop Files Here.bat file. As it name says you can simply drag and drop any app you want to install to this file and it will install it automatically in any connected device. Note that some zip files that have Android Manifest.xml file can be installed using ADB like apk files. You can use any archive explorer like WinRar to make sure if your zip has Android Manifest file or not.
Q. How to view log cat with adb?
A. To view log cat simply run the command adb logcat. Or, if you are comfortable with terminal emulator you can type adb shell to get to the terminal and then type logcat and press enter to view the log cat. Notice that second method is similar to using terminal emulator. You can run many other commands that can be run on android/Linux in this shell.
Q. How do I copy files/directory to my phone or android emulator?
A. To copy files to your phone use adb push
command. If you want to copy cm7.zip to root of your sdcard then run adb push cm7.zip /sdcard/cm7.zip command. Make sure you have the file in same folder as adb.exe is otherwise you will need to provide full path to your file.
Q. How do I copy files/directory from my phone or emulator?
A. To copy files from your device run adb pull
command. If you want to copy camera.apk app to your pc then run adb pull /system/app/Camera.apk /Camera.apk. You might need to remount system as read write before you can copy file to/from system folder. To remount your system files as read write run adb remount command.
These are some basic questions mostly asked about ADB. You can find more information on using ADB at Android Developer’s Website. If you need any help or have problem using ADB please feel free to ask in comments below.