adb for mobile QA: 40 commands that save hours
ADB (Android Debug Bridge) is the main tool for mobile QA on Android. It installs apps, captures logs, takes screenshots, simulates network, proxies requests, and much more. A list of commands that are actually used during regression and bug triage β without the endless βcopy an example from StackOverflowβ.
Connection and server
β adb devices β list connected devices with their serial. First check if a device βwent missingβ.
β adb kill-server β stops the adb server. Helps when commands hang.
β adb start-server β bring it back up.
β adb connect <ip>:5555 β connect to device over Wi-Fi (first run adb tcpip 5555 over USB).
β adb usb β switch back to USB mode.
β adb pair <ip>:<port> β pairing on Android 11+ for wireless debugging.
Install / uninstall apps
β adb install path/to/app.apk β install a build.
β adb install -r path/to/app.apk β reinstall keeping data.
β adb install -d path/to/app.apk β allow version downgrade.
β adb uninstall com.example.app β uninstall.
β adb uninstall -k com.example.app β uninstall but keep app data.
App info
β adb shell pm list packages β all installed packages.
β adb shell pm list packages -3 β only third-party (non-system).
β adb shell pm path com.example.app β APK path on device.
β adb shell pm clear com.example.app β wipe app data (β βfresh first launchβ).
β adb shell dumpsys package com.example.app β full package info: permissions, activities, services.
Files
β adb pull /sdcard/Download/log.txt ./ β download a file from device.
β adb push ./test-data.json /sdcard/Download/ β push to device.
β adb shell ls /sdcard/ β directory listing.
β adb shell rm /sdcard/old.log β delete file.
β adb shell cat /sdcard/log.txt β print contents.
Logs and diagnostics
β adb logcat β live log stream.
β adb logcat *:E β errors only (E = Error).
β adb logcat -s "MyTag" β filter by tag.
β adb logcat > log.txt β save to file.
β adb logcat -c β clear log buffer before reproducing the bug.
β adb shell dumpsys β state of every system service (huge report).
β adb shell dumpsys battery β battery specifically.
β adb shell dumpsys meminfo com.example.app β app memory usage.
Screenshots and recording
β adb shell screencap -p /sdcard/screen.png β png screenshot.
β adb shell screenrecord /sdcard/video.mp4 β screen recording (Ctrl+C to stop).
β adb shell screenrecord --time-limit 30 /sdcard/video.mp4 β with time limit.
β adb shell screenrecord --bit-rate 8000000 /sdcard/video.mp4 β higher bitrate.
Simulation and testing
β adb shell input tap 500 1500 β tap at coordinates.
β adb shell input text "hello" β type text.
β adb shell input keyevent KEYCODE_HOME β press Home.
β adb shell am start -n com.example.app/.MainActivity β launch an activity.
β adb shell am force-stop com.example.app β kill the app.
β adb shell am broadcast -a android.intent.action.BOOT_COMPLETED β send broadcast (for testing receivers).
Network
β adb shell ip addr β IP addresses.
β adb shell ping <host> β connectivity check.
β adb forward tcp:6123 tcp:7123 β port forward from Mac to device.
β adb forward --list β all active forwards.
β adb reverse tcp:8080 tcp:8080 β reverse, from device to Mac (useful if the device should hit localhost).
System properties
β adb shell getprop β all system properties.
β adb shell getprop ro.build.version.release β specifically Android version.
β adb shell setprop debug.test true β set a property (needs root).
β adb root β restart adb with root (debug builds of Android only).
Top-5 commands I use most often
β
adb shell pm clear <package> β before every onboarding test. Saves hours vs reinstalling.
β
adb logcat -c && adb logcat β clear buffer β reproduce bug β save logs. Clean snapshot, no noise.
β
adb pull /sdcard/Download/... β grab a crash report or test artifact onto the Mac.
β
adb shell input keyevent 26 β lock/unlock the screen programmatically (test lock-screen behavior).
β
adb shell screenrecord β for bug reports, a GIF/video is 10Γ more informative than a screenshot.
What to do right now
β Put this cheat sheet into Notion or as a ~/.zshrc alias-comment.
β Assign yourself one command per day β try it on a test device.
β When you find a bug β try to reproduce via adb shell input instead of using the mouse. You get a reproducible scenario that can later be automated.