Essential ADB Commands Every Developer Should Know

ADB (Android Debug Bridge) is the Swiss Army knife of Android development. Once you’ve installed ADB and understand how it works, the next step is mastering the commands that make your development workflow faster and more powerful.

This guide covers the essential ADB commands you’ll use daily, organized by what you’re trying to accomplish—not alphabetically dumped like most references.

Terminal window with command line code
Command-line interface showing ADB commands

Device Connection & Management

Check Connected Devices

The first command you’ll run every session:

adb devices

Output shows device serial numbers and connection state:

List of devices attached
1234567890ABCDEF    device
emulator-5554       device
9876543210FEDCBA    unauthorized

Status meanings:

  • device: Ready for commands
  • unauthorized: Accept USB debugging prompt on device
  • offline: Device not responding (replug USB or restart ADB)
  • no permissions: Linux udev rules issue
  • Set up Wireless ADB to debug over WiFi without cables

💡 Pro Tip: Use adb devices -l to see device model and product name for easier identification when multiple devices are connected.

Target a Specific Device

When multiple devices are connected, specify which one:

adb -s 1234567890ABCDEF shell getprop ro.product.model

The -s flag works with any ADB command. You can also use -d (only USB device) or -e (only emulator).

Restart ADB Server

When devices aren’t detected or ADB acts weird:

adb kill-server
adb start-server

This solves 80% of ADB connection problems.

App Installation & Management

Mobile app development with device and laptop
Mobile app development workflow with ADB

Install an APK

adb install path/to/app.apk

Useful flags:

  • -r: Reinstall while keeping app data
  • -d: Allow version downgrade
  • -g: Grant all runtime permissions automatically
  • -t: Allow test APKs

Example: Reinstall a debug APK with all permissions:

adb install -r -g app-debug.apk

List Installed Packages

adb shell pm list packages

Filters: -3 (third-party), -s (system), -e (enabled), -d (disabled)

Find specific apps:

adb shell pm list packages | grep chrome

Grant/Revoke Permissions

Grant a permission:

adb shell pm grant com.example.myapp android.permission.CAMERA

Revoke a permission:

adb shell pm revoke com.example.myapp android.permission.CAMERA

File Operations

Copy Files to Device (Push)

adb push local-file.txt /sdcard/

Common destinations: /sdcard/ (external storage), /data/local/tmp/ (temporary, world-writable), /sdcard/Download/

Copy Files from Device (Pull)

adb pull /sdcard/screenshot.png

Pull to specific location:

adb pull /sdcard/photo.jpg ~/Pictures/

Debugging & Logs

Code debugging on computer screen
Debugging code with terminal output

View Logcat

Real-time logs:

adb logcat

This floods your terminal. Use filters:

Clear existing logs first:

adb logcat -c

Filter by priority (V=Verbose, D=Debug, I=Info, W=Warn, E=Error, F=Fatal):

adb logcat *:E  # Errors only

Filter by your app:

adb logcat | grep com.example.myapp

Save logs to file:

adb logcat -d > logcat.txt

Screen Capture & Recording

Take a Screenshot

adb shell screencap -p /sdcard/screenshot.png
adb pull /sdcard/screenshot.png

One-liner:

adb exec-out screencap -p > screenshot.png

Record Screen Video

adb shell screenrecord /sdcard/demo.mp4

Press Ctrl+C to stop recording, then pull:

adb pull /sdcard/demo.mp4

Options: --time-limit 30 (max 30 seconds), --bit-rate 6000000 (higher quality), --size 1280x720 (custom resolution)

System Control

Simulate Input

Type text (use %s for spaces):

adb shell input text "Hello%sWorld"

Press keys:

adb shell input keyevent 3   # Home
adb shell input keyevent 4   # Back
adb shell input keyevent 26  # Power
adb shell input keyevent 66  # Enter

Tap screen coordinates:

adb shell input tap 500 1000

Get Device Information

Android version:

adb shell getprop ro.build.version.release

Device model:

adb shell getprop ro.product.model

Screen resolution:

adb shell wm size

Battery status:

adb shell dumpsys battery

Workflow Scenarios

Programming workflow with multiple monitors
Development workflow with multiple tools

“I want to quickly test my APK”

adb install -r app-debug.apk
adb shell am start -n com.example.myapp/.MainActivity
adb logcat | grep "com.example.myapp"

“I want to debug a crash”

adb logcat -c  # Clear old logs
# Reproduce crash
adb logcat -d > crash.txt
grep -A 20 "AndroidRuntime" crash.txt

“I want to pull database from device”

adb shell run-as com.example.myapp cp /data/data/com.example.myapp/databases/app.db /sdcard/
adb pull /sdcard/app.db

Troubleshooting Common Issues

Issue Cause Solution
“device unauthorized” USB debugging prompt not accepted Unlock device, accept prompt, check “Always allow”
“no devices found” Device not detected or ADB server issue adb kill-server && adb start-server
“insufficient permissions” (Linux) udev rules not configured Install 51-android.rules, reload udev
“more than one device” Multiple devices without -s flag Use adb -s <serial> command
Logcat overwhelming output Too many logs Use filters: adb logcat *:E or grep

Quick Reference Tables

Most-Used Commands

Command Purpose Example
adb devices List connected devices adb devices -l
adb install Install APK adb install -r app.apk
adb uninstall Remove app adb uninstall com.app
adb shell Device shell access adb shell ls /sdcard/
adb logcat View logs adb logcat *:E
adb push Copy to device adb push file.txt /sdcard/
adb pull Copy from device adb pull /sdcard/file.txt
adb shell pm Package manager pm list packages -3

Common Keyevent Codes

Code Key Usage
3 Home adb shell input keyevent 3
4 Back adb shell input keyevent 4
26 Power adb shell input keyevent 26
66 Enter adb shell input keyevent 66
67 Delete (Backspace) adb shell input keyevent 67
24/25 Volume Up/Down adb shell input keyevent 24

Important File Paths

Path Contents
/sdcard/ External storage root
/sdcard/Download/ Downloads folder
/data/app/ Installed APKs
/data/data/<package>/ App’s private data
/data/data/<package>/databases/ SQLite databases
/data/local/tmp/ Temporary (world-writable)

💡 Bash Tip: Add aliases to ~/.bashrc for frequently-used commands like alias adbfix='adb kill-server && adb start-server' or alias logcat-error='adb logcat *:E'

Next Steps

You now have the ADB commands needed for daily Android development. Continue learning:

  • Set up Wireless ADB to debug over WiFi without USB cables
  • Advanced ADB Shell Commands for system-level control
  • ADB Troubleshooting Guide for common errors and solutions
  • Developer Tools: Compare GitHub Copilot, Cursor, and Claude Code for AI-assisted coding

ADB is your direct line to Android devices. Master these commands, and you’ll debug faster, test more efficiently, and control devices like a power user.

Related Guides:


Sources:

Last updated: September 2, 2026

1 thought on “Essential ADB Commands Every Developer Should Know”

Leave a Comment