ADB Android: A guide to debugging your devices


ADB Android—or Android Debug Bridge—is a powerful command-line tool to execute various instructions on Android devices. ADB Android commands empower you to perform actions on the device that might otherwise be challenging to achieve directly.

In this article, we'll explore exactly what ADB Android is, how to install and configure it, and the most common ADB Android commands. 

What is Android Debug Bridge? 

ADB Android is a powerful command-line tool for issuing commands to your Android device. Developers use it to generate bug reports, view info about a device, and install standalone Android packages. ADB Android offers many of the same advantages as SSH but it shouldn't be used for currently deployed devices. 

ADB Android client, server, and daemon

ADB Android requires three components to work:

  1. ADB client: Runs on your development machine and sends commands to target devices using the ADB command from the command line.
  2. ADB daemon (ADBd): Runs on the target device, managing the ADB Android communication.
  3. ADB server: Manages the communication as a background process on your development machine.

How ADB Android works

When initiating an ADB client, it checks for an existing ADB server. If none is found, the client starts the server, which binds to local TCP port 5037 and awaits client commands.

Key points to note:

  • ADB clients communicate with the ADB server via port 5037.
  • The server establishes connections with all active devices.
  • Emulators are identified by scanning odd-numbered ports between 5555 and 5585, reserved for the first 16 emulators.
  • Each emulator has two ports: The even-numbered port is for console connections, and the odd-numbered port is for ADB connections.
  • For instance, Emulator 1's console connects through port 5554, while its ADB connections are made through port 5555.
  • This pattern continues for subsequent emulators (e.g., Emulator 2 uses ports 5556 for consoles and 5557 for ADB).
  • It's important to note that the emulator associated with ADB port 5555 corresponds to the emulator with console port 5554
  • Once the server establishes connections with all devices, you gain the ability to utilize ADB commands to interact with those devices.
  • The server effectively manages connections and commands from multiple ADB clients, allowing device control from any client or script.

ADB Android with USB or WiFi

ADB was originally developed for devices connected through USB. In order for developers to debug their devices or install new apps, devices were connected to the PC (host) with a USB cable. 

Windows users are still required to install USB ADB drivers, so ADB can be used. However, in order to use that, the device must provide USB Peripheral or USB OTG (USB "On-the-Go") mode like a smartphone. 

Unfortunately, some devices (including RPi 2 and 3) only supported USB Host mode, which cannot be used for ADB connections. In order to still be able to debug them, Google implemented ADB over Network and later ADB over WiFi in addition to the classic ADB over USB. 

The official documentation still differentiates those cases, and this also explains why users sometimes need to enable "USB Debugging" on their devices, even if they use ADB over Network.

Instructions for Android Debug Bridge download and install

ADB is included in the Android SDK (Software Development Kit). To install it, download the SDK from the official Android developer website. If you're using Android Studio, you don't need to separately install ADB Android because it comes bundled with Android Studio as a single package. 

Android Studio ADB provides convenient functions integrated into the GUI, such as starting the server with a single button click.

How to install ADB Android debug bridge?

If you're just getting started with ADB Android, you should download the Android SDK Platform Tools to install ADB Android. 

Android ADB downloads exist for:

  • Windows
  • Mac
  • Linux

For this tutorial, we'll be discussing how to install on Windows using a USB cable.

After downloading, extract the files into a folder on your computer. 

Next, you'll need to enable USB debugging on your device:

  1. Launch the Settings app on your device.
  2. Locate and select the About Phone option.
  3. Scroll to the bottom of the screen.
  4. Tap Build Number seven times continuously.
  5. A message will appear confirming that you have become a developer.
  6. Return to the Settings menu and select System.
  7. Tap on Advanced to reveal additional options.
  8. Look for Developer Options and enter the menu.
  9. Inside the Developer Options, locate and enable USB Debugging.
You'll get a huge warning on your device when attempting to enable USB debugging. That's because ADB Android shouldn't be used on production devices, due to the lack of strong authentication mechanisms. For that, rather use SSH for Android. But ADB Android is excellent and simple to set up for testing and debugging. 

Warning enabled USB debugging Source: Android Phone / Screenshot

Connect your device to your computer using a USB cable. Then navigate to the folder where you extracted the platform tools earlier. 

Hold down the shift key, then right-click in the folder and select Open in Terminal or Open PowerShell window here. For non-Windows 11 users, you might see Open command window here or Open PowerShell window here.

Navigate to the Terminal/PowerShell window

Source: Windows / Screenshot

Type ./ADB devices into the PowerShell terminal (or simply ADB devices into a normal command prompt):

Type ./ADB devices into the PowerShell terminal

Source: Windows / Screenshot

As you can see above, there's no need to run ADB start-server because ADB calls that function automatically if a server isn't already running. When ADB Android detected that no ADB daemon was running, it started the daemon on TCP Port 5037. 

No devices were connected, so ADB Android didn't list any. But if you check your Android device, you should see a message to allow USB Debugging. Accept "Always allow from this computer" and then type in ./ADB devices again. 

List of connected devices

Source: ADB/ Screenshot

Now, you'll see your device connected. As you can see above, we connected an emulator device for this tutorial. 

If you still don't see your device, you might need to install the appropriate Android Debug Bridge driver for your device. 

How do I run Android Debug Bridge?

ADB Android is a command-line utility that you can run by opening a terminal in the same path as the ADB.exe file. ADB is also enabled as part of Android Studio, and you can run ADB commands directly from within that IDE. 

Most common ADB commands Android

The following ADB commands overview for Android lists the most common ADB shell commands for Android. It would be impossible to list all of them in a single post, but this will cover most of your ADB actions. 

Connectivity ADB Android commands

Connectivity commands manage the connection between your computer and Android devices using ADB Android. These commands enable various interactions and control over devices. 

adb start-server 

Start the ADB server on your computer. This will be executed automatically. 

adb devices 

Lists all devices in the network that have the ADBd (ADB daemon) running. 

adb connect <ip> 

e.g., ADB connect

Connect to a specific device via IP or device name.

adb disconnect 

Disconnect from a specific device. 

adb kill-server 

Close the local ADB server on your computer. 

File Handling ADB Android commands

File Handling ADB Android commands deal with operations related to transferring files between your computer and connected Android devices. These commands let you conveniently manage files on ADB devices.

adb push <local filepath> <device filepath> 

e.g., ADB push /oem/media/ 

Transfers a local file from your computer to the specified file path on the device. 

adb pull <device filepath> <local filepath> 

Transfers a file from the device to your local computer. 

APK Handling ADB Android commands

APK Handling ADB Android commands handle Android application package files (APKs). These commands let you install and uninstall APKs on connected Android devices through your dev machine's command line.

adb shell pm list packages

See a list of all installed packages on the device. 

adb install <apk path> 

e.g., ADB install myapplication.apk 

Installs a local apk on the connected device. 

adb uninstall <packagename> 

Uninstalls the specified package from the device. 

Debugging ADB Android commands

The ADB Debugging commands provide tools for debugging and troubleshooting Android devices using ADB. These commands let you gather and analyze logs and generate comprehensive bug reports.

adb shell dmesg

Prints kernel logs. 

adb logcat 

Prints Android logs in your local shell. It can also be piped into a file. 

adb bugreport 

Creates a comprehensive bug report from the connected device and saves it to your computer.

Device Handling ADB Android commands

Device Handling ADB Android commands manage and interact with connected Android devices using ADB. These commands grant additional privileges, enable remounting of partitions, facilitate device reboot, and provide access to the device's shell. 

adb root 

Gives you additional rights. For example, to access the /system partition on the device. 

adb remount  

Remounts the /system partition to be writable.

adb reboot 

Reboots the connected device.

adb shell 

Connects you to the shell of the connected device.

Download cheat sheet with all commands

Device Shell 

The most common command you'll use in this category is the ADB shell input text command:

adb shell input text <any text> 

This command emulates keystrokes on the device. No need to type things out on your device. Just copy and paste it into your shell. 

Source: ADB / Screenshot

Android Debug Bridge turnoff instructions

To stop using ADB Android, type in ADB kill-server on your development machine, then switch off USB Debugging on your device by navigating to Settings>Developer Options>USB Debugging

Switching off ADB when you're not using it is vital because ADB lacks the appropriate security measures to ensure safe communications. It shouldn't be used on actively deployed devices or left on accidentally when you're not using it. 

What is the alternative to Android Debug Bridge?

No alternative exists for ADB Android as such. If, however, you wish to execute shell commands against currently deployed devices, consider using Android SSH instead because ADB Android lacks the necessary security measures for production devices.

MDM (Mobile Device Management) might be a better option

Depending on your use case, MDM might be a better option. For example, ADB doesn't allow for Over-the-Air software updates. Many production devices also don't allow root access, reducing the possibilities for ADB usage. ADB also requires a lot of manual typing and parsing of logs. 

MDM is a user-friendly option that simplifies many ADB functions, and adds further ones, so that fleet managers can manage their devices remotely, and carry out updates as needed. 

Next steps with ADB Android

Although you can carry out many advanced tasks with ADB Android, other solutions exist for production devices that are inherently more secure or better integrated. For example, emteria's Device Hub lets you manage entire fleets of Android devices from your browser. You can execute commands directly against devices, even when they're not in the same network, and do many of the things that ADB Android lets you do—securely and while your devices are being used. 

Emteria's Android OS also lets you perform regular IoT OTA updates, and it comes preconfigured with SSH. You can manage Android device fleets using emteria's browser-based Device Hub

Build unique Android products, keep them up-to-date

See why emteria is the chosen Android™ customization & management platform for product builders — build Android products based on your requirements.

Book live demo
Group 3113

Table of contents

emteria Demo
See emteria in action