ADB: Android Debug Bridge Fundamentals and Popular Commands

Author: IT Sectr Published: 2026-02-12 Reading time: 10 min

ADB (Android Debug Bridge) is a versatile command-line utility that is part of the Android SDK. It allows a computer to directly interact with an Android device via USB cable or Wi-Fi. With ADB you can install and uninstall applications, copy files, run shell commands, view system logs, take screenshots and screen recordings, manage settings, and even perform automated tests. The tool is indispensable for developers, testers, and enthusiasts who want full control over their device.

Key Takeaways

  • ADB is a command-line debugging tool for Android, part of the SDK platform tools
  • Connection — works via USB and Wi-Fi (adb tcpip / adb connect)
  • Basic commands — adb devices, adb shell, adb install, adb uninstall, adb pull / push
  • Logging — adb logcat with filtering by tags and severity levels
  • Screenshots and recording — adb shell screencap and adb shell screenrecord
  • Multiple devices — adb -s to target a specific device
  • Automation — adb shell input for simulating taps, swipes, and text input

What is ADB and Why You Need It

Android Debug Bridge (ADB) is a client-server application consisting of three components: a client (running on the computer), a server (a background process on the computer), and a daemon adbd (running on the Android device itself). When a developer or engineer connects a smartphone to a PC, ADB creates a reliable communication channel through which commands, files, and data can be transmitted.

The main use cases of ADB include debugging applications on a real device without needing to publish an APK to a store, extracting logs for error analysis, test automation, data backup, flashing recovery images, and gaining root access. Even if you do not write code, ADB can be useful for extracting screenshots from apps, recording a video guide from the phone screen, or recovering a device after an unsuccessful firmware update.

ADB support is built into all official Android builds starting from version 2.1 (API 7). It requires the USB Debugging option to be enabled in the developer settings. Starting with Android 4.2, the device prompts for confirmation on first connection: you must allow debugging for the specific computer using its RSA key.

Installing ADB on Your Computer

For Windows — download Platform Tools from the official Google Developers website, extract the archive to C:\adb and add this path to the PATH environment variable. After restarting the terminal, the adb command will be available globally.

For macOS — the easiest way is to install ADB via the Homebrew package manager: run brew install android-platform-tools. All dependencies will be resolved automatically.

For Linux — on Debian / Ubuntu based distributions: sudo apt install adb. After installation, add the user to the plugdev group: sudo usermod -aG plugdev $USER and log back in so ADB can access USB devices.

Verify the installation with the adb version command. If the output shows the Android Debug Bridge version number, the tool is ready to use.

Connecting a Device and Basic Commands

First connection always starts with the adb devices command. It displays a list of connected devices and their status. If the device shows as unauthorized, unlock the screen and confirm debugging on the phone.

adb devices
List of devices attached
emulator-5554   device
0123456789ABCD  device

Installing an app is one of the most frequent operations. Just specify the path to the APK file:

adb install C:\apps\myapp.apk

If the app is already installed but needs to be replaced with an updated version, add the -r (replace) flag:

adb install -r C:\apps\myapp-v2.apk

Uninstalling an app is done by package name:

adb uninstall com.example.myapp

Copying files — adb pull retrieves a file from the device to the computer, adb push uploads a file to the device:

adb pull /sdcard/DCIM/screenshot.png .
adb push myfile.txt /sdcard/Documents/

Interactive shell — the adb shell command opens the device command shell. Inside it you can run standard Linux commands: ls, ps, top, dumpsys, pm, am and others.

adb shell
tissot_sprout:/ $ ls -la /sdcard/
tissot_sprout:/ $ ps | grep com.android.chrome

Starting an activity via ADB lets you open any app or screen without manually searching for the icon:

adb shell am start -n com.android.chrome/com.google.android.apps.chrome.Main

Working with Logs: Logcat

Logcat is the Android logging system that collects messages from applications, system services, and the kernel. The tool is indispensable for debugging: logs help you understand why an app crashed, which method caused an exception, or how long a particular operation takes.

A simple launch without filters — adb logcat. The log stream is infinite; press Ctrl+C to stop. To filter messages by tag, use the -s parameter:

adb logcat -s MainActivity:V

Logging severity levels (from most detailed to critical): V (Verbose), D (Debug), I (Info), W (Warning), E (Error), F (Fatal). Combining a tag and a level lets you highlight only the needed messages.

To clear the accumulated buffer before a test:

adb logcat -c

And to save logs to a file:

adb logcat -d > app_logs.txt

The -d (dump) flag outputs the current buffer and exits without blocking the terminal. This is convenient for automation scripts.

Screenshots, Screen Recording, and Useful Diagnostic Commands

Screenshot is taken with the adb shell screencap command. The result is saved to a file, which is then retrieved via adb pull:

adb shell screencap /sdcard/screen.png
adb pull /sdcard/screen.png

You can combine both operations into one line using substitution and piping. In practice this speeds up creating documentation and test reports.

Screen recording is available on Android 4.4+ (API 19). The default recording duration is 180 seconds, bitrate is 4 Mbps. The main command:

adb shell screenrecord /sdcard/demo.mp4

Press Ctrl+C to stop recording. Video resolution matches the device screen resolution but does not exceed 1080p. To change the bitrate specify --bit-rate:

adb shell screenrecord --bit-rate 8000000 /sdcard/demo.mp4

Diagnostic commands: adb shell dumpsys outputs the state of all system services. To get battery information only:

adb shell dumpsys battery

The list of installed packages can be obtained via Package Manager:

adb shell pm list packages

Resetting app settings (equivalent to clearing data in settings):

adb shell pm clear com.example.myapp

Advanced ADB Capabilities

Wi-Fi debugging eliminates the need to keep the device connected via USB. Make sure the computer and device are on the same network. First run adb tcpip 5555, disconnect USB, then connect via IP:

adb tcpip 5555
adb connect 192.168.1.100:5555

If the device IP address is unknown, find it via adb shell ip addr show wlan0 before disconnecting the cable.

Data backup of an app or the whole system can be performed without root:

adb backup -apk -shared -all -system -f mybackup.ab

Restoring from a backup:

adb restore mybackup.ab

Input emulation — the adb shell input command allows simulating taps, swipes, key presses, and text input. This is the foundation for UI test automation without additional frameworks:

adb shell input tap 500 1000
adb shell input swipe 300 500 800 500
adb shell input text "Hello, ADB!"

Rebooting into different modes:

adb reboot          # normal reboot
adb reboot recovery # recovery mode
adb reboot bootloader # bootloader (fastboot)

Fastboot mode provides access to flashing images, unlocking the bootloader, and installing custom recovery.

Working with Multiple Devices

When multiple devices or emulators are connected simultaneously, ADB requires a specific serial number. The adb devices command lists all connected devices with their serial numbers.

To address a command to a specific device use the -s flag:

adb -s 0123456789ABCD install myapp.apk

If there is only one device, the flag can be omitted. However in a CI environment where multiple emulators run simultaneously, specifying the serial number is mandatory.

Killing the ADB server — if a device stops being detected or throws an error, restarting the server helps:

adb kill-server
adb start-server

After that run adb devices — the server will restart and redirect requests to the device daemons.

Essential ADB Commands: Reference Table

Command Description
adb devices Show list of connected devices
adb install Install an APK file on the device
adb uninstall Uninstall an app by package name
adb shell Open an interactive command shell
adb push Copy a file from computer to device
adb pull Copy a file from device to computer
adb logcat View system and app logs
adb shell screencap Take a screenshot
adb shell screenrecord Record screen video
adb reboot Reboot the device
adb tcpip 5555 Switch ADB to TCP/IP mode for Wi-Fi
adb connect :5555 Connect to a device over Wi-Fi

Frequently Asked Questions

How do I enable USB debugging if the Developer options menu is hidden?

Open Settings → About Phone and tap Build Number 7 times. Go back to the main settings menu — the Developer options section will appear. Inside, enable USB debugging. Starting with Android 4.2, when connecting to a computer for the first time, you must confirm the RSA debugging key on the device screen.

Why does the adb devices command show unauthorized status?

The device does not trust the computer. Unlock the phone screen, when the Allow USB Debugging dialog appears, check Always allow for this computer and tap OK. If the dialog does not appear, disconnect and reconnect the USB cable or run adb kill-server && adb start-server.

How do I install an APK on a device without a screen (broken display)?

ADB does not require screen interaction. Connect the device via USB, wait for it to appear in adb devices (if debugging was already enabled) and run adb install . To launch the app use adb shell am start -n /. If debugging was not enabled beforehand, restoring access without a screen is significantly harder — custom recovery will be needed.

How is adb install different from installing via Google Play?

ADB installs the APK directly, bypassing Google Play Protect checks during installation, allowing you to test apps before publishing. However the final malware scan still runs after installation. ADB does not require a Google account, which is important for corporate kiosks and devices without Google services.

Can I use ADB without root access on the device?

Yes, the vast majority of ADB commands work without root. Exceptions are commands that require access to protected system partitions (for example, direct dump of the boot partition or modifying system files). For everyday tasks — installing apps, logging, screenshots, backups, input emulation — root is not required.

Conclusion

ADB (Android Debug Bridge) is a fundamental tool for anyone working with Android at a professional level. From basic app installation to complex test automation and device recovery — ADB covers virtually every scenario of computer-to-smartphone or tablet interaction.

By mastering the commands described in this article, you will be able to confidently manage an Android device through the terminal, analyze logs, take screenshots for documentation, perform backups, and speed up the development process. Regular practice and studying the output of adb help will make you an experienced user of this powerful tool.

Summary

  • ADB is a command-line debugging tool for Android, part of the Platform Tools Android SDK
  • Connection — works via USB and Wi-Fi with adb tcpip and adb connect commands
  • Basic commands — adb devices, adb shell, adb install, adb uninstall, adb pull / adb push
  • Logcat — Android logging system with filtering by tags and severity levels V/D/I/W/E/F
  • Screenshots and recording — adb shell screencap and adb shell screenrecord for capturing images and video
  • Advanced features — Wi-Fi debugging, data backups, input emulation, rebooting into fastboot and recovery
  • Multiple devices — the -s flag to select a specific device when multiple are connected

We will develop a mobile application turnkey

IT Sectr creates iOS and Android applications for startups and businesses since 2017. We will advise you and propose the best solution.

Discuss the project

Read also