Join Us as a Contributor Journalist

What is Android Debug Bridge (ADB) How does it work?

by

developer programmer staff Look for system errors. system maintenance

Is it the first time you have come across the term Android Debug Bridge or ADB? If so, then this article is for you. Here, we will discuss everything related to Android Debug Bridge (ADB). Android Debug Bridge (ADB) is a command-line tool that links one device to another. You can use this tool to bridge communication between an emulator (a handset) and a server. Using ADB, you can perform several tasks, including installing a handset, debugging a handset, and so on. However, it is crucial to opt for reliable Android Testing services in India for the best outcomes. To make an informed decision, it is crucial to have complete awareness of ADB. If you are new to this term, then continue reading this post. This comprehensive guide explains everything about ADB, including the ways you can install it on different operating systems. So, let’s get started. First off, let’s first understand the fundamentals of ADB.

What is Android Debug Bridge (ADB)?

Android Debug Bridge, or ADB, as the name says, is a command line tool specifically designed for Android devices. Android users can use this tool to install applications or debug their devices (both phones and tablets). In addition, it can be used to send a large number of commands in order to control behavior on the device. This tool is composed of three distinct parts, which includes:

ADB Client or Client Interface: The first part is the client interface that lives on the machine and is utilized for development or debugging, transmitting commands to your device or emulator via the command line terminal.  

ADB Daemon or ADBD: Secondly, there is a Daemon ADB. The daemon is nothing but the ADB component that runs in the background of the emulators (or devices). It accepts and executes commands from the ADB server.

ADB Server: The third component is the server on your development machine. It connects your devices or emulators.

How Does ADB Work?

As said earlier, ADB is a command-line tool. It enables communication between Android devices and computer systems. Here is how ADB works:

  1. Connection Setup: ADB is used to link a connection between your Android device and your computer. It can be done either with a USB cable or over a wireless network. Here, the computer serves as the client, and the Android device acts as the server. Here are the steps you’ll need to follow:
  • Start as the Android Debug Bridge client. Upon doing so, it will first check whether or not an ADB server processing is already running. Know that confirmation is crucial to start the process. 
  • If you find there is no ADB server processing running, then you’ll have to start the server process. 
  • Upon starting, the server binds to the nearby TCP port 3057 and listens for commands from ADB users.
  1. Client-Server Model: ADB operates on a client-server model with three main components discussed above:
  • ADB Client: ADB client is the command-line interface that is used to issue commands, and it runs on your computer.
  • ADB Daemon (ADBD): ADBD is a service that runs on the Android device. Its job is to execute commands received from the ADB client.
  • ADB Server: The ADB server runs in the background on your computer and manages the communication between the computer and the Android device. 
  1. Command Execution: Upon issuing a command through the ADB client (e.g., installing an app or debugging your handset), the ADB server forwards the command to the ADB daemon that runs on the Android device. The daemon then executes the command and relays back the results to the ADB client on the computer.
  2. Debugging & Development: Android Debug Bridge is designed for development and debugging. Users can use this tool to execute various commands. This includes installing APK files, debugging applications, controlling the device remotely, and accessing system logs. Aside from that, ADB can also be used for more extensive tasks, such as file transfer rooting and flashing firmware.

ADB is an essential tool for Android developers; it supports both Android 11 and Android 12. This robust tool provides developers with flexibility and control over Android devices for testing and debugging. 

Now, let’s understand how you can install ADB on different operating systems. Here we go…

How to install ADB on Windows?

Here are the steps that you can follow to set up ADB in Windows. Take a look…

STEP 1: Go to Android Studio and download the Android SDK Platform Tools ZIP file for Windows.

STEP 2: Once downloaded, extract the ZIP file to a folder in your Windows device.

STEP 3: Now, open File Explorer and search for the contents of this ZIP file.

STEP 4: Right-click an empty area of the File Explorer window and select Open in Terminal. For older versions of Windows without Windows Terminal, hold Shift on the keyboard while right-clicking, then select Open PowerShell window here.

STEP 5: Now, connect your device (phone or tablet) to your computer using a USB cable. Now, change the USB mode to “file transfer (MTP)” mode. 

STEP 6: Enter the command ./adb devices in the Terminal window to launch the ADB daemon.

STEP 7: You will now see a prompt on your phone’s screen to either allow or deny USB Debugging access. Tap Allow.

STEP 8: Now, re-enter the command./adb devices

STEP 9: The moment you re-enter the command, your device’s serial number will appear in the Terminal window. That’s all, enjoy running any ADB command on your device! 

How to install ADB on macOS?

If you wish to install ADB in MacOS, then follow the steps below: 

STEP 1: Go to Android SDK Platform Tools and download the Android SDK Platform Tools ZIP file for macOS.

STEP 2: Once downloaded, extract the content of the ZIP file in a folder. 

STEP 3: Now, open Terminal.

STEP 4: Now search for the folder you extracted your ADB into using the following command cd/path/to/extracted/folder.

STEP 5: Now, connect your device to your MacOS using a USB cable. Change the USB connection mode to “file transfer (MTP)” mode. 

STEP 6: Upon connecting, execute the following command to launch the ADB daemon ./adb devices

STEP 7: You will now see a prompt asking you to Allow USB debugging. Click Allow the connection.

STEP 8: Now, re-enter ./adb devices 

STEP 9: Upon re-entering the command, you will be able to see your device’s serial number in macOS’s Terminal window. This signifies that you are now allowed to run the ADB command on your Mac.

How to install ADB on Linux?

Let’s now take a look at the steps to set up ADB on Linux. Read on

STEP 1: Go to the official Android SDK Platform Tools download page and download SDK Platform Tools for Linux.

STEP 2: Now, extract the content of the ZIP file in a folder.

STEP 3: Now, open a Terminal window.

STEP 4: Search for the content of the extracted file using path/to/extracted/folder command. 

STEP 5: Now, connect your device to your Linux machine with the help of the USB cable. Change the connection mode to file transfer (MTP) mode. 

STEP 6: Once the Terminal is located in the same folder as your ADB tools, execute the following command to launch the ADB daemon: ./adb devices

STEP 7: You’ll now see a prompt asking you to allow USB debugging. Select Allow 

STEP 8: Re-enter the command ./adb devices.

STEP 9: Your device’s serial number will be visible in the Terminal window output. Now, you can run ADB command on your device.

If you have a mainstream Debian/Ubuntu or Fedora/SUSE-based distro of Linux, then you need not to follow steps 1 and 2; instead, you can use any one of the following commands:

Debian/Ubuntu-based Linux users can install ADB using the following command: sudo apt-get install android-sdk-platform-tools

Fedora/SUSE-based Linux users can install ADB using the following command: sudo dnf install android-tools

However, it is always better to opt for the latest binary from the Android SDK Platform Tools release since the distro-specific packages often contain outdated builds.

The Bottom Line 

So, this is all about the Android Debug Bridge. ADB is a flexible tool that helps developers in Android development and troubleshooting. Using this tool, developers can communicate with Android devices via a command-line interface. It allows them to undertake several tasks, including installing an app, updating a system, debugging an app, and so on. The best thing about this tool is that it is very easy to use. Users can connect their computers to an Android device just with a USB cable. Android Debug Bridge helps execute shell commands, manage file transfers, access the device’s logs, and so on. Seasoned developers are already using this tool to test and maintain Android applications. The best thing about ADB is that it comes as part of Android Studio, Google’s IDE (Integrated Development Environment) for Android app development. However, you can even download it as a standalone tool if you don’t require the full IDE. 

Read More Blogs