---
title: "20 ADB Commands Every Test Engineer Should Know"
description: "The ADB commands that matter most in Android test automation: device management, installs, log capture, screen recording, battery and network simulation, permissions."
url: https://sanderyaz.com/en/blog/adb-commands-for-testers/
author: Sander Yazıcıoğlu
date: 2026-12-02
updated: 2026-12-02
lang: en
tags: ["Android","ADB","Test automation","Mobile"]
---

# 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

```bash
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

```bash
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

```bash
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

```bash
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

```bash
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

```bash
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](/en/blog/appium-flaky-tests/).

## Permissions

```bash
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

```bash
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

```bash
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.

---

About the author: [Sander Yazıcıoğlu](https://sanderyaz.com/en/about/). Sander Yazıcıoğlu is a Senior Full-Stack Developer in Istanbul. At LiveTesting he builds the backend, frontend, realtime systems and Appium automation of a real-device testing platform; before that he built enterprise Angular apps at Testinium and Loadium.
