Android · ADB · Test automation · Mobile

20 ADB Commands Every Test Engineer Should Know

The ADB commands that matter most in Android test automation: device management, installs, log capture, screen recording, battery and network simulation, permissions.

Sander Yazıcıoğlu Published: 1 min read Türkçe oku

20 ADB Commands Every Test Engineer Should Know

When writing Appium tests or running a device farm, the tool I open most is Android Debug Bridge (ADB). I grouped the commands you need to debug a failure, prepare a device before tests, or reproduce a problem.

Device management

adb devices -l                     # connected devices and models
adb -s R58N12ABCDE shell           # pick a device by serial when several are attached
adb shell getprop ro.build.version.release   # Android version
adb shell getprop ro.product.model           # device model
adb reboot                         # restart the device

Make -s a habit whenever more than one device is attached; sending a command to the wrong device is the most common mistake.

Installing and managing apps

adb install -r -g app-release.apk        # reinstall (-r), grant all permissions (-g)
adb uninstall com.example.app
adb shell pm clear com.example.app       # reset app data
adb shell pm list packages | grep example
adb shell am start -n com.example.app/.MainActivity
adb shell am force-stop com.example.app

pm clear gives you a clean start without reinstalling, which saves a lot of time between tests.

Capturing logs

adb logcat -c                                  # clear old logs
adb logcat -v time > device.log                # save with timestamps
adb logcat '*:E'                               # errors only
adb logcat --pid=$(adb shell pidof -s com.example.app)   # only the app's logs

Clearing with logcat -c before a test and recording during it lets you attach only the relevant logs to a failed test's report.

Screenshots and recordings

adb exec-out screencap -p > screen.png
adb shell screenrecord --time-limit 60 /sdcard/run.mp4
adb pull /sdcard/run.mp4 .

screenrecord records at most three minutes; record longer tests in segments.

Simulating input

adb shell input tap 540 1200
adb shell input swipe 540 1600 540 400 300
adb shell input text 'hello'
adb shell input keyevent KEYCODE_BACK

Handy for quick experiments, but prefer Appium selectors over coordinates in real tests.

Preparing a device for tests

adb shell settings put global window_animation_scale 0
adb shell settings put global transition_animation_scale 0
adb shell settings put global animator_duration_scale 0
adb shell settings put system screen_off_timeout 1800000
adb shell svc power stayon usb

Turning off animations removes one of the most common causes of flaky tests. I collected the others in flaky Appium tests: 8 root causes.

Permissions

adb shell pm grant com.example.app android.permission.CAMERA
adb shell pm revoke com.example.app android.permission.ACCESS_FINE_LOCATION

Testing how the app behaves when a permission is denied is a scenario that is often missed.

Battery and network simulation

adb shell dumpsys battery set level 5     # low battery
adb shell dumpsys battery unplug
adb shell dumpsys battery reset
adb shell svc wifi disable                # turn off Wi-Fi
adb shell cmd connectivity airplane-mode enable

Low battery and offline are situations real users hit all the time, yet tests rarely try them.

Diagnostics

adb shell dumpsys meminfo com.example.app   # memory usage
adb shell dumpsys gfxinfo com.example.app   # frame times, jank
adb shell df -h /data                       # free space
adb bugreport bugreport.zip                 # everything in one report

Conclusion

ADB is the Swiss army knife of Android test automation. Put these commands into scripts to automate device preparation, log capture and scenario simulation, and your test results become far more reliable.

Flaky Appium Tests: 8 Root Causes and Lasting Fixes

December 2, 2026 · 3 min read

Flaky Appium Tests: 8 Root Causes and Lasting Fixes

The eight most common reasons Appium tests pass one run and fail the next, from timing and selectors to device state and test data, and how to fix them for good.

AppiumTest automationMobileQA

All articles →