ADB Productivity Tips: Save Time using Android Debug Bridge Shortcuts

Last updated: Sep 12, 2025

Android Debug Bridge Shortcuts That Save Minutes Daily in Android Studio

Android Debug Bridge Shortcuts (ADB) are the fastest way to cut wasted minutes in Android Studio. Instead of clicking through menus, developers can rely on these ADB productivity tips to install apps, capture logs, transfer files, or reboot devices in seconds.

Every Android developer should master at least ten Android Debug Bridge time savers, they pay off daily and streamline your workflow.

This guide answers common “How do I…?” questions with real terminal outputs, reusable scripts, and shortcuts. Use these tested ADB tricks to speed up installs, logging, cache clears, and multi-device debugging.

How do I install an APK on a connected device or emulator using Android Debug Dridge (ADB)?

Installing app-debug.apk successfully using ADB command.

Use adb install with the path to your APK. For example:

$ adb install app-debug.apk

This copies the APK to the device and installs it. By default, it installs fresh; to update an existing app (without losing data), add -r (reinstall). In a multi-device setup, specify the target:

Command Prompt listing Samsung A15 device detected by ADB.
# List devices/serials
$ adb devices
List of devices attached
emulator-5554	device
emulator-5556	device

# Install on emulator-5556
$ adb -s emulator-5556 install app-debug.apk

The -s flag directs the command to a specific serial number. (You can also use -d to target only a USB device or -e for only an emulator when one device is connected.) Android Studio typically handles installs during development, but knowing adb install is useful for quick manual installs or testing outside the IDE.

How can I specify a particular device or emulator for adb commands?

First, list attached devices with adb devices -l. This shows each device’s serial, state, and model. For example:

$ adb devices -l
List of devices attached
emulator-5556	device	product:sdk_phone_x86_64	model:Android_SDK_built_for_x86_64
1234ABCD	device	model:Pixel_5	device:redfin

To run a command on one device, use its serial via -s:

$ adb -s 1234ABCD install app.apk

If multiple devices/emulators are connected, using -d tells ADB to target the only USB-connected device, and -e targets the only emulator. If you’ll run many commands on the same device, you can also set the ANDROID_SERIAL environment variable to that serial.

These options let you quickly switch targets without re-plugging devices. (The official docs note that adb devices -l lists serials and states for each device.) If you forget to specify a target and multiple devices are connected, ADB shows an error like “more than one device” and offers these -s/-d/-e flags as the solution.

How do I clear an app’s cache or data using ADB?

Clearing app data successfully with ADB shell command.

To reset an app’s data (including cache), use the package manager’s clear command via adb shell. For example:

$ adb shell pm clear com.example.myapp

This deletes all data for the given package. In practice, you often use it after testing to start the app fresh without reinstalling. (Note: this deletes app data and cache. Android’s package manager doesn’t have a built-in “cache only” flag via ADB; clearing cache usually requires root or manual steps. The general clear clears everything.) You can also combine commands: e.g.

$ adb shell pm uninstall --user 0 com.example.myapp  # uninstall for current user
$ adb shell pm clear com.example.myapp               # clear data (cache+db)

Another trick: if you’re testing and just want to reinstall without losing data, use adb install -r (reinstall) instead of uninstalling. In summary, adb shell pm clear is the fastest way to wipe an app’s data/cache.

How can I capture or save device logs efficiently with ADB?

Saving Android system logs into logs.txt using ADB.

ADB’s built-in logcat tool dumps system logs (including app Log.d/e messages) to the terminal. A simple shortcut:

$ adb logcat

This streams live logs. To filter by tag or priority, use expressions (for example adb logcat MyAppTag:D *:S to see only Debug+ logs from “MyAppTag” and silence others). To save logs to a file for analysis, use -d (dump) with output redirection:

$ adb logcat -d > myapp_log.txt

This dumps the entire log buffer since the last reboot into myapp_log.txt on your computer. (You can clear logs first with adb logcat -c if you want only recent entries.)

For example, running:

$ adb logcat -d | grep "MyAppTag"

will dump logs and filter for your app’s tag. Another useful command is adb bugreport > report.zip, which captures full system state and logs (useful for bug triage). In Android Studio, you normally use the Logcat window, but command-line logcat is great when working in scripts or remote shell. (See Our Guide on Flutter Plugin Development for Android Studio).

How do I transfer files between my computer and the device/emulator?

Pushing local.txt from PC to /sdcard/Download using ADB push

Use adb push and adb pull. These copy files between host and device. For example:

# Push a file from PC to device
$ adb push localfile.txt /sdcard/Download/

# Pull a file from device to PC
$ adb pull /sdcard/Download/data.db ~/Desktop/

This will copy localfile.txt into the device’s Download folder, and pull data.db out to the desktop. As the official docs note, adb push [source] [dest] and adb pull [remote] [local] work like you’d expect. You can also push whole directories with the same commands. This is faster than opening file explorers, and can be scripted easily. For example, adb pull /sdcard/DCIM ./photos grabs all photos from the device. The gist cheat sheet confirms these commands: adb push [source] [destination] and adb pull [device_location] [local_location].

What reboot commands are useful in ADB?

Device reboot initiated using ADB command.

ADB can reboot the device or reboot into bootloader/recovery. Key commands include:

  • adb reboot – Restarts the device normally.
  • adb reboot recovery – Reboots into the Recovery menu (without holding buttons).
  • adb reboot-bootloader – Restarts into the bootloader (fastboot).

For example:

$ adb reboot

will reboot the attached device immediately. These shortcuts save time versus manually long-pressing power/volume. Also, if you make a change (like an unlocked bootloader) and need root ADB temporarily, adb root restarts adbd with root permissions (on emulators or rooted devices only). After using adb root and testing, use adb unroot to go back. Knowing reboot options cuts minutes from testing workflows.

What are some handy ADB shell commands or tricks to navigate the device?

You can open an interactive shell on the device with:

$ adb shell

Once inside, you have a Linux-like terminal on the device. Some useful shell commands:

  • Navigate file system: ls, cd (e.g. adb shell ls /sdcard/Download)
  • Run Activity Manager commands: e.g. adb shell am start -a android.intent.action.VIEW to start an activity.
  • Generate UI input: e.g. adb shell input tap x y or adb shell input text 'hello'.
  • Dump CPU/process info: e.g. adb shell dumpsys battery or adb shell top.

For example, to see running processes: adb shell ps | grep myapp. Or to take a screenshot from the device:

Capturing device screenshot with adb shell screencap.
$ adb shell screencap -p /sdcard/screen.png
$ adb pull /sdcard/screen.png .

That lets you capture the device screen via ADB. Another trick: use adb tcpip 5555 and adb connect <ip>:5555 to switch to Wi-Fi debugging (see HowTo below and Android Studio Debugging tips).

Finally, you can chain commands on one line. For instance, on Linux/macOS:

$ adb devices | tail -n +2 | cut -f1 | xargs -I{} adb -s {} install -r myApp.apk

This installs an APK on all connected devices. Aliases and small scripts are great: e.g., in Bash you could add alias alog='adb logcat | grep' to filter logs quickly. The GitHub repo “adb-shell-scripts” provides example scripts for common tasks.

Figure: Using adb pair to connect a device (entering a wireless pairing code in terminal) (screenshot from Android docs)

Reusable ADB scripts and aliases

Automating repetitive ADB workflows saves time. For example, on macOS/Linux you might put this in ~/.bashrc or ~/.zshrc:

alias adbl='adb devices -l'          # list devices in detail
alias adbreboot='adb reboot'         # quick reboot
alias adblog='adb logcat -d > log.txt'  # save logs to file
alias adbinstall='adb install -r'    # install (replace existing, keep data)

And a short script (named apush in PATH) could wrap pushing and installing:

#!/bin/bash
# apush: push an APK and install it in one go
APK_PATH="$1"
adb push "$APK_PATH" /data/local/tmp/
adb shell pm install -r /data/local/tmp/$(basename "$APK_PATH")

The adb-shell-scripts repo collects useful functions; as its README notes, “shell scripts to make Android development a bit easier… wrappers around functionality ADB provides”. Experiment to create aliases for your most-used commands. Over time, these small shortcuts can save minutes each day.

Table: Common ADB Commands and Use Cases

CommandDescriptionUse Case Example
adb devicesLists connected devices (serial numbers, state)Check which devices/emulators are connected (adb devices).
adb install <apk>Installs an APK on target deviceQuickly deploy an app: adb install MyApp.apk.
adb uninstall <package>Uninstalls an app from deviceRemove test app: adb uninstall com.example.myapp.
adb shell pm clear <pkg>Clears all data (cache/db) for appReset app to initial state without uninstalling.
adb logcat [-d]Dumps device log (use -d to output to file)Capture logs: adb logcat -d > debug.log.
adb push <src> <dest>Copy file/dir from PC to deviceTransfer file: adb push image.png /sdcard/Download/.
adb pull <src> <dest>Copy file/dir from device to PCRetrieve file: adb pull /sdcard/Download/data.db ./.
adb rebootReboot device (normal)Restart device after a change.
adb reboot bootloaderReboot into bootloader/FastbootFor unlocking bootloader or flashing.
adb -s <serial> <cmd>Direct command to specific deviceWhen multiple devices, e.g. adb -s emulator-5554 logcat.
adb -d/<kbd>-e flags-d for USB device, -e for emulatorQuickly target the USB phone vs emulator.

How We Tested

We verified these tips on multiple OS environments: Windows 11 (Figure used from Windows), Ubuntu 22.04 (Linux), and macOS 13 (Ventura), all with Android SDK Platform-Tools v34+. Tests were conducted using a Samsung A15 (API 34). For each command above, we connected devices via USB (and tested the wireless pairing workflow) and confirmed the output. The table and scripts were validated on these setups.

FAQ

Q: What is adb devices and why is it useful?

A: adb devices lists all connected Android devices and emulators by serial number (with state). It’s often the first step to ensure your device is visible to ADB. If no devices appear, you may need to enable USB debugging on the device. A successful adb devices response looks like:

$ adb devices
List of devices attached
emulator-5556	device
0123456789ABCDEF	device

This confirms ADB can communicate with both the emulator and the physical device.

Q: How do I use -s, -d, or -e with ADB?

A: When multiple devices are connected, ADB needs to know which one to target. Use -s <serial> to specify a device by its serial number. Use -d to target the only USB-connected device, or -e to target the only emulator. For example, adb -s emulator-5556 install app.apk installs the app on the specified emulator. Without these, ADB will error out if more than one device is attached.

Q: Can I update an installed app without losing its data?

A: Yes. Use adb install -r MyApp.apk. The -r flag reinstalls the app and keeps its data and cache. This is helpful to quickly deploy a new build without clearing settings. (If you want to fully reset the app, use adb shell pm clear <package> to wipe data.)

Q: How can I quickly grab a screenshot or video of my device’s screen?

A: For screenshots, use adb shell screencap. For example:

$ adb shell screencap -p /sdcard/screen.png
$ adb pull /sdcard/screen.png .

For screen recording: adb shell screenrecord /sdcard/demo.mp4, then adb pull it. These avoid using the device UI and work well in automated tests. They are much faster than manually pressing buttons on the device.

Q: How do I clear only the cache of an app via ADB?

A: Android’s package manager does not provide a one-step “clear cache only” command for modern devices. The adb shell pm clear <package> command wipes all app data (which includes cache). To clear only the cache without data would require root or clearing the cache directory manually in a rooted shell. For most needs, pm clear is the fastest “reset” but remember it also deletes preferences and databases.

Q: How can I run multiple ADB commands more efficiently?

A: You can pipe and chain commands. For example, to install on every connected device:

adb devices | tail -n +2 | cut -f1 | xargs -I{} adb -s {} install -r myApp.apk

This pulls each device serial and applies the install. Also, using shell aliases (like alias adbreboot='adb reboot') or simple scripts (Bash, batch, etc.) for your common sequences will save keystrokes. The GitHub repo “adb-shell-scripts” has examples of such scripts for tasks like installing, logging, or listing activities.

Who should (and shouldn’t) use this

These ADB tips are aimed at Android developers who spend time on the command line and want to speed up their workflow. If you mostly use Android Studio’s graphical tools (e.g. the Run and Logcat windows), some shortcuts here may be less critical.

However, any developer who often needs to manually install APKs, grab logs, push files, or write automation scripts will benefit from these tricks. Testers and CI pipelines also use adb extensively.

Conversely, if you only work on apps via the IDE without scripting or remote debugging, you may not use all these commands every day. In short, use these ADB productivity tips if you want faster CLI operations; skip advanced options if you’re a pure GUI user.

Leave a Comment