What is ADB? How to connect my phone via USB using ADB?
Android Device Bridge, abbreviated as ADB, is a versatile command line tool that lets a machine communicates with a device. It is versatile because it can perform lots of tasks. For example:
- Installing an app
- Debugging an app
- Uninstalling an app — It lets a user uninstall an app that can not be uninstalled by simple using a phone like google play movies, google play music etc.
- Copying files
It is a client-server program that has three components.
- Client: A client sends instructions as a command to the targeted device through a terminal or command prompt.
- Daemon: Daemon runs as a background process in the targeted device to perform the command.
- Server: Server acts as a communication medium between the client and the daemon.
How to connect a phone to a PC via ADB?
Well, the steps are pretty simple.
First, a user have to prepare the environment. This includes preparing the PC and preparing the targeted device, in this case the smartphone.
1. Preparing the PC:
1. Download the SDK platform from the official website.
2. Extract the ZIP file on PC. It is necessary to extract the files on your C drive, user can extract the zip file on any drive.
Now PC is ready.
2. Preparing the phone:
The USB debugging option resides under the Developer option. In Android 4+ the developer option is hidden and needs to be unlocked. To unlock the developer option, you need to:
1. Go to “Settings”.
2. Go to “About Phone” or “About Device”.
3. Scroll doe to the option “Build Number” seven times to unlock the developer option. Depending upon on your device you may need to tap “Build number”, “Software version”, “Software information”.
4. Type your pattern/PIN if the prompt appears.
4. Now the developer option is visible in the settings menu. Depending upon the device, it may appear under: Settings > General > Developer options or Settings > Additional settings > Developer options.
If you can not find, simply search “Developer settings” on the search bar in settings.
5. As developer option is turned on, now scroll down to find the option “USB debugging” under “DEBUGGING” section and turn on.
The phone is ready now.
Connecting the devices via USB
Now, as both the phone and the machine(PC) are ready, a user just need to connect this both device via ADB.
To connect the devices, follow the below procedure.
- Connect the devices via USB.
- In the machine, head over to the folder where the SDK platform was extracted. The name of the extracted folder may look like “platform-tools_r33.0.1-windows”. Under the folder there will be another folder with name “platform-tools”, open it.
- In the navigation bar, type “cmd” and then press enter. It will open the windows command prompt like this:
4. In the command prompt, run the command “adb devices”.
5. The command prompt dialogue box in the phone asking for permission to allow USB debugging. Tap “OK”. User may uncheck the option “Always allow from this computer”. If the user unchecks the option the device will still be connected, but every time the user tries to connect to the machine via ADB the prompt will appear.
5. After running the command, the “command prompt” show the device under “List of device attached” with the device ID.
The devices are now connected via ADB to perform various tasks including installing and uninstalling an application, copying and moving files etc.