Cheatsheet - Android & ADB
Quick-reference cheatsheet for Android Debug Bridge (ADB), Fastboot, Logcat, and device diagnostic commands.
Connection & Device Setup
# Device discovery
adb devices # List connected devices / emulators
adb devices -l # List devices with model and product details
# Wireless debugging (Android 11+)
adb pair ip:port <pairing_code> # Pair device over Wi-Fi
adb connect ip:port # Connect to paired wireless device
# Server management
adb kill-server # Terminate ADB host daemon
adb start-server # Restart ADB host daemon
adb reboot # Normal reboot
adb reboot bootloader # Reboot into Fastboot mode
adb reboot recovery # Reboot into Recovery mode
Package Management & App Installation
# Installing & updating APKs
adb install app.apk # Install APK
adb install -r app.apk # Reinstall and keep application data
adb install -d app.apk # Allow version downgrade
adb install-multiple split*.apk # Install split APKs / app bundles
# Uninstalling
adb uninstall com.example.app # Completely remove app
adb uninstall -k com.example.app # Keep cache and data directories
# Package inspection
adb shell pm list packages # List all installed package names
adb shell pm list packages -3 # List only third-party (user-installed) packages
adb shell pm list packages -s # List only system packages
adb shell pm path com.example.app # Print filesystem path to installed base APK
adb shell pm clear com.example.app # Reset app state (clear data and caches)
File Transfers & Shell Commands
# Push & Pull files
adb push local_file.txt /sdcard/ # Copy file from PC to device
adb pull /sdcard/dump.png ./ # Copy file from device to PC
# Interactive shell
adb shell # Open remote interactive Linux shell
adb shell getprop ro.build.version.release # Read Android OS version
adb shell getprop ro.product.model # Read device hardware model name
# Taking screenshots and screen recordings
adb shell screencap -p /sdcard/screen.png
adb pull /sdcard/screen.png
adb shell screenrecord --size 1280x720 /sdcard/demo.mp4 # Press Ctrl+C to stop
Diagnostics, Dumpsys & Memory Inspection
# Memory inspection
adb shell dumpsys meminfo com.example.app # Detailed RAM footprint (Native/Java Heap, PSS)
adb shell cat /proc/meminfo # Kernel memory statistics (ZRAM, Available RAM)
# Battery & thermal diagnostics
adb shell dumpsys battery # Battery health, level, temperature, charging status
adb shell dumpsys battery reset # Reset simulated battery states
# Activity & Window management
adb shell dumpsys activity top # Display currently visible foreground Activity
adb shell dumpsys window | grep -i mCurrentFocus # Inspect focused window/app
# UI automation & Key events
adb shell input keyevent 26 # Power button press
adb shell input keyevent 3 # Home button press
adb shell input keyevent 4 # Back button press
adb shell input text "hello_world" # Type text into focused input field
adb shell input tap 500 1000 # Simulate screen tap at (x, y) coordinates
Logcat & Crash Diagnostics
# Live logs
adb logcat # Stream live device logs
adb logcat -v time # Include timestamps in log output
adb logcat -c # Clear existing log buffer
adb logcat *:E # Filter logs: show only Errors
# Tag and PID filtering
adb logcat -s "MyTag" # Filter by specific Log tag
adb logcat --pid=$(adb shell pidof -s com.example.app) # Filter logs for specific app process
# Native crashes and tombstones
adb shell ls -la /data/tombstones/ # Inspect native crash tombstones (segfaults, aborts)
adb bugreport ./bugreport.zip # Capture full system dump for bug triage
Fastboot (Bootloader Operations)
# Fastboot operations (Device in bootloader mode)
fastboot devices # List connected fastboot devices
fastboot getvar all # Query all bootloader variables (boot slots, unlocked status)
fastboot oem unlock # Unlock bootloader (erases user data!)
# Flashing partitions
fastboot flash boot boot.img # Flash kernel image
fastboot flash recovery recovery.img# Flash custom recovery
fastboot reboot # Reboot back to normal system
Recommended ReadingSponsored
Cheatsheets - Kubernetes
Cheatsheets - Cloud
Cheatsheets - Tools
Cheatsheets - Editors
Cheatsheets - Databases
Cheatsheets - Shell
Cheatsheets - Lookups


