Android Command Line Tools Every Developer Should Know — Part 1
2026-06-15
AndroidADBDebuggingCLIToolslogcatdumpsysAndroid development isn't just about writing Kotlin and designing layouts. A huge part of the job is debugging — and the command-line tools bundled with the Android SDK are some of the most powerful debugging instruments available. Yet many developers barely scratch the surface of what they can do.
This is Part 1 of a series covering the CLI tools I use most often. Today: adb, logcat, dumpsys, bmgr, and sqlite3.
1. adb — Android Debug Bridge
If there's one tool every Android developer uses daily, it's adb. It creates a communication bridge between your machine and a connected device or emulator, enabling you to install apps, run shell commands, transfer files, and interact directly with Android system services.
Connecting to a device
adb devices
Lists all connected devices and emulators. You'll see something like:
List of devices attached
emulator-5554 device
R3CT204XXXX device
Installing APKs
adb install app.apk
adb install -r app.apk # reinstall / replace existing
Running shell commands
adb shell # open an interactive shell
adb shell ps -A # list all running processes
adb shell stop # stop the Android framework
adb shell start # restart the Android framework
Transferring files
adb push file.txt /sdcard/ # copy from machine to device
adb pull /sdcard/file.txt . # copy from device to machine
Rebooting
adb reboot # normal reboot
adb reboot bootloader # reboot into fastboot
adb reboot recovery # reboot into recovery
adb is the entry point to everything else in this list. Most of the tools below are invoked via adb shell.
2. logcat
logcat is Android's logging system. It streams log output from the framework, native code, system services, and your own app — all in one place. It's the first thing to check when something crashes or behaves unexpectedly.
Basic usage
adb logcat
This streams everything. It's noisy — you almost always want to filter.
Filtering by tag and priority
adb logcat ActivityManager:I *:S
This shows only ActivityManager logs at Info level and silences everything else (*:S). The priority levels are V (Verbose), D (Debug), I (Info), W (Warning), E (Error), F (Fatal), S (Silent).
adb logcat MyTag:D *:S # only your tag at Debug+
adb logcat *:E # all errors across the system
Saving logs to a file
adb logcat -d > logs.txt
The -d flag dumps the current buffer and exits rather than streaming continuously. Useful for capturing a snapshot right after a crash.
Clearing the buffer
adb logcat -c
Wipe the log buffer before reproducing a bug so you don't end up searching through noise from a previous run.
3. dumpsys
dumpsys queries Android system services and dumps their internal diagnostic state. It's invaluable when you need to understand what the system is actually doing at runtime — not just what your app thinks it's doing.
List all available services
adb shell dumpsys
This prints a list of every registered system service followed by their full state dumps. It's a lot of output — pipe it to grep or target a specific service.
Activity stack and running tasks
adb shell dumpsys activity
Shows the full activity stack, task history, running processes, and recent tasks. Essential for debugging navigation, back-stack issues, or process lifecycle problems.
Battery state
adb shell dumpsys battery
Example output:
Current Battery Service state:
AC powered: false
USB powered: true
Wireless powered: false
status: 2
health: 2
level: 85
temperature: 320
Temperature is in tenths of a degree Celsius, so 320 = 32.0°C.
Memory usage
adb shell dumpsys meminfo
Breaks down memory consumption per process — PSS, private dirty, heap size, etc. When you suspect a memory leak, this is your starting point.
Other useful services
adb shell dumpsys wifi # Wi-Fi state, scan results, connected network
adb shell dumpsys power # wake locks, screen on/off state
adb shell dumpsys media.audio_flinger # audio routing and sessions
adb shell dumpsys package com.example.app # installed package details
You can also combine it with grep to zero in on exactly what you need:
adb shell dumpsys activity | grep "mResumedActivity"
4. bmgr — Backup Manager
bmgr lets you interact with Android's backup and restore system from the command line. It's particularly useful when testing features that rely on BackupAgent or Auto Backup, because waiting for the system to trigger a backup on its own during development is painfully slow.
Enable/disable backup
adb shell bmgr enable true
adb shell bmgr enable false
Trigger an immediate backup
adb shell bmgr backupnow com.example.app
Manually kicks off a backup for your app without waiting for the scheduler. The result tells you whether the backup succeeded or what went wrong.
List available transports
adb shell bmgr list transports
Shows which backup transport is active (Google cloud backup, local, etc.). The active one is marked with *.
5. sqlite3
Most Android apps store data in SQLite databases under /data/data/<package>/databases/. The sqlite3 shell tool lets you inspect and query those databases directly — without needing a third-party DB browser or rooting the device in a special way.
Open a database
adb shell sqlite3 /data/data/com.example.app/databases/app.db
This drops you into an interactive SQLite shell.
Common commands inside the shell
.tables -- list all tables
.schema users -- show CREATE statement for a table
SELECT * FROM users; -- query all rows
SELECT * FROM users WHERE id = 1;
.quit -- exit
Useful tips
If you get a Permission denied error, the app's database isn't world-readable (as expected on non-rooted devices). On a debug build you can use run-as:
adb shell run-as com.example.app sqlite3 databases/app.db
Or copy the database out first:
adb shell run-as com.example.app cp databases/app.db /sdcard/app.db
adb pull /sdcard/app.db
Then open the local copy with any SQLite browser.
Putting It All Together
These tools are most powerful when combined. A typical debugging workflow might look like:
- logcat — spot the exception or unexpected log line
- dumpsys activity — confirm the activity stack matches what you expect
- dumpsys meminfo — rule out a memory issue if the app is slow
- sqlite3 — verify the database state if data isn't persisting correctly
- bmgr backupnow — trigger a backup/restore cycle to reproduce a data migration bug
What's Coming in Part 2
In the next part, I'll cover the APK analysis and signing tools: aapt2, apkanalyzer, apksigner, zipalign, and bundletool — the tools you need when you're inspecting what's actually inside a built APK, optimizing it for distribution, or debugging signing issues before uploading to the Play Store.