ADB Android Control Skill
Complete Android device control and automation via ADB (Android Debug Bridge) for Claude Code.
When to Use This Skill
Use this skill when user asks about:
- Device Management: Connect, disconnect, check status, device info
- App Operations: Install, uninstall, list packages, clear data, force stop
- File Transfer: Push/pull files between host and device
- Screen Control: Screenshots, screen recording, mirroring
- Input Simulation: Taps, swipes, text input, key events
- Shell Access: Run commands on device
- Debugging: Logcat, dumpsys, process info
- Automation: Scripted workflows, batch operations
Quick Reference
Device Connection
# Check connected devices
adb devices
# Connect wirelessly (device already paired)
adb connect <device-ip>:<port>
# Disconnect
adb disconnect <device-ip>:<port>
# Kill ADB server (troubleshooting)
adb kill-server && adb start-server
App Management
# List all packages
adb shell pm list packages
# List third-party apps only
adb shell pm list packages -3
# Search for specific package
adb shell pm list packages | grep -i "keyword"
# Install APK
adb install /path/to/app.apk
# Install with options
adb install -r app.apk # Replace existing
adb install -d app.apk # Allow downgrade
adb install -g app.apk # Grant all permissions
# Uninstall app
adb uninstall com.example.app
# Keep data when uninstalling
adb uninstall -k com.example.app
# Clear app data
adb shell pm clear com.example.app
# Force stop app
adb shell am force-stop com.example.app
# Get app info
adb shell dumpsys package com.example.app
# Get APK path
adb shell pm path com.example.app
# Extract APK from device
adb pull $(adb shell pm path com.example.app | cut -d: -f2) ./app.apk
# Disable/Enable app
adb shell pm disable-user com.example.app
adb shell pm enable com.example.app
# List disabled packages
adb shell pm list packages -d
File Operations
# Push file to device
adb push local_file.txt /sdcard/
# Push directory
adb push ./local_dir /sdcard/
# Pull file from device
adb pull /sdcard/file.txt ./
# Pull directory
adb pull /sdcard/DCIM ./photos
# List files on device
adb shell ls -la /sdcard/
# Create directory
adb shell mkdir -p /sdcard/MyFolder
# Delete file
adb shell rm /sdcard/file.txt
# Delete directory
adb shell rm -rf /sdcard/MyFolder
# Check storage space
adb shell df -h
# Find files
adb shell find /sdcard -name "*.jpg" -type f
Screenshots & Screen Recording
# Take screenshot (save on device)
adb shell screencap /sdcard/screenshot.png
# Take screenshot (direct to local)
adb exec-out screencap -p > screenshot.png
# Screen recording (max 180 seconds)
adb shell screenrecord /sdcard/video.mp4
# Screen recording with options
adb shell screenrecord --time-limit 30 --size 720x1280 --bit-rate 4000000 /sdcard/video.mp4
# Stop recording: Ctrl+C or wait for time limit
# Pull recording
adb pull /sdcard/video.mp4 ./
Input Simulation
# Tap at coordinates (x, y)
adb shell input tap 500 1000
# Swipe (x1, y1, x2, y2, duration_ms)
adb shell input swipe 500 1500 500 500 300
# Swipe up (scroll down)
adb shell input swipe 500 1500 500 500 200
# Swipe down (scroll up)
adb shell input swipe 500 500 500 1500 200
# Swipe left
adb shell input swipe 800 1000 200 1000 200
# Swipe right
adb shell input swipe 200 1000 800 1000 200
# Long press
adb shell input swipe 500 1000 500 1000 1000
# Input text (no spaces)
adb shell input text "HelloWorld"
# Input text with spaces (use %s)
adb shell input text "Hello%sWorld"
# Key events
adb shell input keyevent KEYCODE_HOME
adb shell input keyevent KEYCODE_BACK
adb shell input keyevent KEYCODE_MENU
adb shell input keyevent KEYCODE_POWER
adb shell input keyevent KEYCODE_VOLUME_UP
adb shell input keyevent KEYCODE_VOLUME_DOWN
adb shell input keyevent KEYCODE_ENTER
adb shell input keyevent KEYCODE_DEL # Backspace
adb shell input keyevent KEYCODE_TAB
adb shell input keyevent KEYCODE_ESCAPE
# Key event codes (numeric)
adb shell input keyevent 3 # Home
adb shell input keyevent 4 # Back
adb shell input keyevent 26 # Power
adb shell input keyevent 24 # Volume Up
adb shell input keyevent 25 # Volume Down
adb shell input keyevent 66 # Enter
adb shell input keyevent 67 # Backspace
adb shell input keyevent 82 # Menu
# Wake up device
adb shell input keyevent KEYCODE_WAKEUP
# Lock device
adb shell input keyevent KEYCODE_SLEEP
# Toggle power (wake/sleep)
adb shell input keyevent KEYCODE_POWER
# Open recent apps
adb shell input keyevent KEYCODE_APP_SWITCH
# Take screenshot via key
adb shell input keyevent KEYCODE_SYSRQ
Activity & Intent Management
# Start activity
adb shell am start -n com.package.name/.ActivityName
# Start with action
adb shell am start -a android.intent.action.VIEW -d "https://google.com"
# Open URL in browser
adb shell am start -a android.intent.action.VIEW -d "https://example.com"
# Open settings
adb shell am start -a android.settings.SETTINGS
# Open specific settings
adb shell am start -a android.settings.WIFI_SETTINGS
adb shell am start -a android.settings.BLUETOOTH_SETTINGS
adb shell am start -a android.settings.DISPLAY_SETTINGS
adb shell am start -a android.settings.SOUND_SETTINGS
adb shell am start -a android.settings.APPLICATION_SETTINGS
# Send broadcast
adb shell am broadcast -a android.intent.action.BOOT_COMPLETED
# Start service
adb shell am startservice -n com.package.name/.ServiceName
# Kill background processes
adb shell am kill-all
# Force stop all background apps
adb shell am kill-all
Device Information
# Get device model
adb shell getprop ro.product.model
# Get Android version
adb shell getprop ro.build.version.release
# Get SDK version
adb shell getprop ro.build.version.sdk
# Get serial number
adb shell getprop ro.serialno
# Get all properties
adb shell getprop
# Get battery info
adb shell dumpsys battery
# Get memory info
adb shell dumpsys meminfo
# Get CPU info
adb shell dumpsys cpuinfo
# Get display info
adb shell dumpsys display | grep -i "mBaseDisplayInfo"
# Get screen resolution
adb shell wm size
# Get screen density
adb shell wm density
# Get WiFi info
adb shell dumpsys wifi | grep -i "mWifiInfo"
# Get IP address
adb shell ip addr show wlan0
# Get network stats
adb shell dumpsys netstats
# Get running processes
adb shell ps -A
# Get top processes (like top)
adb shell top -n 1
# Get storage info
adb shell df -h
Logcat (System Logs)
# View all logs (streaming)
adb logcat
# Clear log buffer
adb logcat -c
# View recent logs (dump and exit)
adb logcat -d
# Filter by tag
adb logcat -s "MyTag:*"
# Filter by priority (V/D/I/W/E/F)
adb logcat "*:E" # Errors only
adb logcat "*:W" # Warnings and above
# Filter specific app
adb logcat --pid=$(adb shell pidof -s com.example.app)
# Save logs to file
adb logcat -d > logs.txt
# View with timestamps
adb logcat -v time
# View with thread info
adb logcat -v threadtime
# Specific buffer
adb logcat -b crash # Crash logs
adb logcat -b events # Event logs
adb logcat -b main # Main log
adb logcat -b system # System log
System Settings
# Get setting value
adb shell settings get system screen_brightness
adb shell settings get global airplane_mode_on
adb shell settings get secure android_id
# Set system settings
adb shell settings put system screen_brightness 128
# Set global settings
adb shell settings put global airplane_mode_on 1
# List all settings
adb shell settings list system
adb shell settings list global
adb shell settings list secure
# Common settings changes
# Brightness (0-255)
adb shell settings put system screen_brightness 200
# Screen timeout (ms)
adb shell settings put system screen_off_timeout 60000
# Enable/disable animations
adb shell settings put global window_animation_scale 0
adb