All cheatsheetsAndroid Development

adb

Android Platform Tools 34+

Quick reference for the Android Debug Bridge CLI: device discovery, install / uninstall, logcat, shell, push / pull, port forwarding, and wireless debugging — with common options and practical examples.

33 commands

Devices

adb devices

List every connected device / emulator with serial and state (`device`, `unauthorized`, `offline`).

-l show long detail (product, model, transport); -e only emulators; -d only USB devices

adb devices -l
adb connect <ip>:<port>

Connect to a device over Wi-Fi or TCP/IP (default port 5555). Pair first with `adb pair <ip>:<port>` for Android 11+.

ip:port; --one-time disconnect on session end

adb pair 192.168.1.42:41235 && adb connect 192.168.1.42:5555
adb disconnect [<ip>:<port>]

Disconnect from one or every wireless device. Pass no argument to drop all connections.

adb disconnect 192.168.1.42:5555 && adb disconnect
adb -s <serial> <command>

Target a specific device when multiple are attached (replace `<serial>` with the value from `adb devices`).

adb -s emulator-5554 shell pm list packages

Install / Uninstall

adb install <apk>

Install an APK. `-r` reinstalls keeping data; `-d` allows version-code downgrade; `-t` allows test-only APKs; `-g` grants all runtime permissions.

-r; -d; -t; -g; --abi <abi>; --user <id>

adb install -r -g app-release.apk
adb install-multi-package <apk1> <apk2>

Install a split APK bundle atomically — used for App Bundles with multiple ABIs / configs.

adb install-multi-package base.apk split_config.arm64.apk
adb uninstall <package>

Uninstall an app by package name. `-k` keeps data + cache directories.

-k keep user data

adb uninstall com.example.myapp

Logcat

adb logcat

Stream the device's log buffer. Tag / priority filters: `*:V` (verbose), `*:E` (errors).

-v threadtime; -d dump and exit; -s <tag>; -t <N>; --pid=<pid>; -f <file> write to file

adb logcat *:E
adb logcat -d

Dump the current buffer to stdout and exit (non-streaming). Combine with grep for one-off inspection.

-d -t 500 last 500 lines

adb logcat -d -t 200 | grep -i 'myapp'
adb logcat -s <tag>:<level>

Show only entries for a specific tag at a given level (V/D/I/W/E). Combine tags with whitespace.

MyTag:D MyTag2:E

adb logcat -s MyApp:V ReactNative:V

Shell

adb shell

Drop into an interactive shell on the device. Most Unix utilities work; `/sdcard` is the public storage root.

-t allocate a TTY (for interactive programs)

adb shell
adb shell <command>

Run a single command on the device and return the output. Quote carefully when mixing host / device args.

adb shell pm list packages | grep com.example && adb shell dumpsys battery
adb shell pm list packages

List installed packages. `-f` shows path, `-3` filters to user-installed apps, `-d` filters to disabled packages.

-f path; -3 user apps; -d disabled; -e enabled; -s system; <filter>

adb shell pm list packages -3 | head -30
adb shell am start -n <package>/<activity>

Launch an activity by its `package/activity` qualified name. Use `am start -W` to wait for the launch to complete.

-a <action>; -d ; --es <key> <val> extra string; -W wait

adb shell am start -n com.example/.MainActivity
adb shell screencap -p /sdcard/screen.png

Capture the device screen to a PNG. Pair with `adb pull` to retrieve.

-p PNG (default)

adb shell screencap -p /sdcard/screen.png && adb pull /sdcard/screen.png .
adb shell input <source> <command>

Inject input events. Common: `tap x y`, `swipe x1 y1 x2 y2 [ms]`, `keyevent <code>`, `text "string"`.

tap; swipe; keyevent; text; roll; press

adb shell input tap 540 1200 && adb shell input keyevent 4

File transfer

adb push <local> <remote>

Copy a local file / directory to the device. Sync semantics; preserves binary files.

--sync overwrite only stale files; --copy-links preserve symlinks; -p show progress

adb push app-debug.apk /sdcard/Download/ && adb push ./assets /sdcard/myapp/assets
adb pull <remote> <local>

Copy a device file / directory to the host. Default destination is `.` (current directory).

-a preserve timestamps; -p show progress

adb pull /sdcard/screen.png ./screenshots/latest.png

Forwarding

adb forward tcp:<host-port> tcp:<device-port>

Forward a host port to a device port — common for opening a Chrome remote-debug socket against a Chrome tab.

--remove; --remove-all

adb forward tcp:9222 localabstract:chrome_devtools_remote
adb reverse tcp:<device-port> tcp:<host-port>

Reverse-forward a device port to a host port — useful when your dev server runs on `localhost:3000` and the device needs to hit it.

adb reverse tcp:3000 tcp:3000 && curl http://localhost:3000/api/health
adb forward --list

List active port forwards and reverses. Pair with `adb forward --remove-all` to reset.

adb forward --list && adb reverse --list

App management

adb shell pm clear <package>

Wipe app data + cache for a specific package — the same effect as `Settings → Apps → Storage → Clear`.

adb shell pm clear com.example.myapp
adb shell pm grant <package> <permission>

Grant a runtime permission (e.g. `android.permission.CAMERA`) without UI prompts — common in test setups.

adb shell pm grant com.example.myapp android.permission.READ_CONTACTS
adb shell am force-stop <package>

Force-stop a running app (its process is killed). Useful when reinstalling a foreground app.

adb shell am force-stop com.example.myapp && adb install -r app.apk

Boot / Recovery

adb reboot

Reboot the device. Variants: `recovery`, `bootloader`, `fastboot`, `download`, `edl`.

recovery | bootloader | fastboot | download | edl

adb reboot bootloader && fastboot flashall
adb sideload <zip>

Sideload a signed OTA / factory image zip from recovery mode (typically entered via `adb reboot recovery`).

adb sideload ota-update.zip

Debugging

adb shell run-as <package> <cmd>

Run a command as the app's UID — required for debuggable APKs to read their own private data directory.

<package> cat ./databases/my.db > /sdcard/dump.db

adb shell run-as com.example.myapp ls databases
adb shell dumpsys <service>

Dump the state of a system service (`battery`, `window`, `activity`, `package`, `gfxinfo`, `netstats`).

battery; activity; package; window; gfxinfo <pkg>; netstats

adb shell dumpsys gfxinfo com.example.myapp framestats

Server

adb start-server

Start the adb server explicitly (it normally auto-starts on any command). Use after `kill-server`.

adb start-server
adb kill-server

Stop the adb server and disconnect every device. Useful when adb gets stuck in `offline` state.

adb kill-server && adb start-server && adb devices

Misc

adb --version

Print Platform Tools version.

adb --version
adb help

List every adb subcommand with one-line descriptions.

adb help

Wireless

adb pair <ip>:<port>

Pair with a device over Wi-Fi using the 6-digit pairing code shown in Developer Options. Then `adb connect` to the actual debug port.

<ip>:<port>

adb pair 192.168.1.42:41235

Related command cheatsheets

About ADB

The Android Debug Bridge (adb) is a command-line tool that ships with the Android SDK Platform Tools (since 2009). It bridges your development workstation to any Android device or emulator over USB, Wi-Fi, or TCP/IP, and exposes three sub-components: a server (runs on the host, port 5037), a daemon (`adbd` runs on the device), and the `adb` CLI. The current Platform Tools line is 34+ (released alongside Android 14). `adb` is the foundation for installing APKs, reading logcat, debugging apps via JDWP, sideloading ROMs, scripting UI tests, and pushing/pulling files. Wireless debugging was added in Android 11 (with QR-pair flow in 13+). Common sibling commands include `fastboot` (bootloader / recovery) and `emulator` (QEMU-based AVDs). ADB never uploads your app's source code — it ships APKs and device state. SDK Platform Tools is licensed under Apache 2.0 and is available as a standalone ZIP or via the SDK Manager.

Cheatsheet version 1.0.0