
Android
- 2 installs
- 30 repo stars
- Updated January 28, 2026
- hyperb1iss/android-skill
Reference for interacting with Android devices over ADB: connecting devices, running shell commands, installing apps, UI automation, viewing logs, and analyzing crashes.
About
A reference for interacting with Android devices via ADB and shell commands, covering device connection, app management, file transfer, UI automation, logcat, dumpsys, and crash analysis. A developer uses it when debugging or automating an Android device from the command line.
- Covers ADB device connection, app install/uninstall, and shell commands
- Includes logcat filtering, dumpsys inspection, UI automation, and crash analysis
Android by the numbers
- 2 all-time installs (skills.sh)
- Ranked #888 of 1,039 Mobile Development skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/hyperb1iss/android-skill --skill androidAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 2 |
|---|---|
| repo stars | ★ 30 |
| Last updated | January 28, 2026 |
| Repository | hyperb1iss/android-skill ↗ |
What it does
Reference for interacting with Android devices over ADB: connecting devices, running shell commands, installing apps, UI automation, viewing logs, and analyzing crashes.
Files
Android Device Mastery
This skill covers everything about interacting with Android devices via ADB and shell commands.
Device Connection
Check Connected Devices
adb devices -lOutput shows serial, status, and device info. Common statuses:
device- Connected and authorizedunauthorized- Accept USB debugging prompt on deviceoffline- Connection issues, tryadb kill-server && adb start-server
Wireless Debugging
Android 11+ (Recommended):
1. Enable Wireless debugging in Developer Options 2. Tap "Pair device with pairing code" 3. Run: adb pair <ip>:<pairing_port> and enter the code 4. Then: adb connect <ip>:<connection_port>
Legacy (requires USB first):
adb tcpip 5555
adb connect <device_ip>:5555Multiple Devices
Always specify device with -s:
adb -s <serial> shell
adb -s emulator-5554 install app.apk---
Shell Commands
Interactive Shell
adb shell # Enter shell
adb shell <command> # Run single command
adb shell "cmd1 && cmd2" # Chain commandsEssential Commands
# Device info
getprop ro.product.model # Device model
getprop ro.build.version.release # Android version
getprop ro.build.version.sdk # SDK level
# File operations
ls -la /sdcard/
cat /path/to/file
cp /source /dest
rm /path/to/file
# Process info
ps -A | grep <name>
pidof <package_name>
top -n 1 -m 10Safe Output Limiting
For commands with potentially large output:
adb shell "logcat -d | head -500"
adb shell "dumpsys activity | head -200"---
App Management
Install/Uninstall
adb install app.apk # Basic install
adb install -r app.apk # Replace existing
adb install -g app.apk # Grant all permissions
adb install -r -g app.apk # Both
adb uninstall com.example.app # Full uninstall
adb uninstall -k com.example.app # Keep dataStart/Stop Apps
# Start main activity
adb shell monkey -p com.example.app -c android.intent.category.LAUNCHER 1
# Start specific activity
adb shell am start -n com.example.app/.MainActivity
# Start with intent extras
adb shell am start -n com.example.app/.Activity \
-a android.intent.action.VIEW \
-d "myapp://page/123" \
--es "key" "value"
# Force stop
adb shell am force-stop com.example.app
# Clear app data
adb shell pm clear com.example.appList Packages
adb shell pm list packages # All packages
adb shell pm list packages -3 # Third-party only
adb shell pm list packages | grep term # Filter
adb shell pm path com.example.app # APK location
adb shell dumpsys package com.example.app # Full package infoPermissions
adb shell pm grant com.example.app android.permission.CAMERA
adb shell pm revoke com.example.app android.permission.CAMERA
adb shell dumpsys package com.example.app | grep permission---
File Operations
Push/Pull Files
adb push local_file.txt /sdcard/
adb pull /sdcard/remote_file.txt ./
# Recursive
adb push local_dir/ /sdcard/target/
adb pull /sdcard/dir/ ./local/Access App Data (Debuggable Apps)
adb shell run-as com.example.app ls files/
adb shell run-as com.example.app cat shared_prefs/prefs.xml
adb shell run-as com.example.app sqlite3 databases/app.db ".tables"---
UI Automation
Input Commands
# Tap at coordinates
adb shell input tap 500 800
# Swipe (x1 y1 x2 y2 [duration_ms])
adb shell input swipe 500 1500 500 500 300
# Text input (needs focused field)
adb shell input text "hello"
# Key events
adb shell input keyevent KEYCODE_HOME # Home
adb shell input keyevent KEYCODE_BACK # Back
adb shell input keyevent KEYCODE_ENTER # Enter
adb shell input keyevent KEYCODE_POWER # Power
adb shell input keyevent KEYCODE_VOLUME_UP # Volume upCommon Keycodes
| Code | Key | Code | Key |
|---|---|---|---|
| 3 | HOME | 4 | BACK |
| 24 | VOL_UP | 25 | VOL_DOWN |
| 26 | POWER | 66 | ENTER |
| 67 | DEL | 82 | MENU |
Screenshots & Recording
# Screenshot
adb shell screencap -p /sdcard/screen.png
adb pull /sdcard/screen.png
# One-liner (binary-safe)
adb exec-out screencap -p > screen.png
# Screen recording (max 3 min)
adb shell screenrecord /sdcard/video.mp4
adb shell screenrecord --time-limit 10 /sdcard/video.mp4UI Hierarchy
adb shell uiautomator dump /sdcard/ui.xml
adb pull /sdcard/ui.xml---
Debugging & Logs
Logcat Essentials
# Dump and exit
adb logcat -d
# Last N lines
adb logcat -t 100
# Filter by tag:priority
adb logcat ActivityManager:I *:S
# Filter by package (get PID first)
adb logcat --pid=$(adb shell pidof -s com.example.app)
# Crash buffer
adb logcat -b crashPriority levels: V(erbose), D(ebug), I(nfo), W(arn), E(rror), F(atal), S(ilent)
Common Debug Patterns
# Find crashes
adb logcat *:E | grep -E "(Exception|Error|FATAL)"
# Activity lifecycle
adb logcat ActivityManager:I ActivityTaskManager:I *:S
# Memory issues
adb logcat art:D dalvikvm:D *:S | grep -i "gc"Memory Analysis
adb shell dumpsys meminfo com.example.appKey metrics:
- PSS: Proportional memory use (compare apps with this)
- Private Dirty: Memory exclusive to process
- Heap: Java/Native heap usage
Crash Analysis
# ANR traces
adb shell cat /data/anr/traces.txt
# Tombstones (native crashes, needs root)
adb shell ls /data/tombstones/
# Recent crashes via logcat
adb logcat -b crash -d---
System Inspection
dumpsys Services
adb shell dumpsys -l # List all services
# Common services
adb shell dumpsys activity # Activities, processes
adb shell dumpsys package <pkg> # Package details
adb shell dumpsys battery # Battery status
adb shell dumpsys meminfo # System memory
adb shell dumpsys cpuinfo # CPU usage
adb shell dumpsys window displays # Display info
adb shell dumpsys connectivity # Network stateSystem Properties
adb shell getprop # All properties
adb shell getprop | grep <filter> # Filter properties
# Useful properties
getprop ro.product.model # Model
getprop ro.build.fingerprint # Build fingerprint
getprop ro.serialno # Serial number
getprop sys.boot_completed # Boot status (1 = done)Settings
# Namespaces: system, secure, global
adb shell settings get global airplane_mode_on
adb shell settings put system screen_brightness 128
adb shell settings list global---
Reboot Commands
adb reboot # Normal reboot
adb reboot recovery # Recovery mode
adb reboot bootloader # Fastboot mode
adb reboot sideload # Sideload mode
adb reboot-bootloader # Alias for bootloader---
Troubleshooting
Device not found:
adb kill-server && adb start-serverUnauthorized:
- Check USB debugging is enabled
- Revoke USB debugging authorizations in Developer Options, reconnect
Multiple devices error:
- Use
-s <serial>to specify device
Command not found (on device):
- Some commands require root or are version-specific
- Try
/system/bin/<cmd>or check if command exists
---
Quick Reference
| Task | Command |
|---|---|
| List devices | adb devices -l |
| Install app | adb install -r -g app.apk |
| Start app | adb shell monkey -p pkg -c android.intent.category.LAUNCHER 1 |
| Stop app | adb shell am force-stop pkg |
| Screenshot | adb exec-out screencap -p > screen.png |
| Logs | adb logcat -d -t 100 |
| Shell | adb shell |
| Push file | adb push local /sdcard/ |
| Pull file | adb pull /sdcard/file ./ |
| Tap | adb shell input tap X Y |
| Back | adb shell input keyevent 4 |
| Home | adb shell input keyevent 3 |
For deep dives into specific topics, see references/deep-dive.md.
Android Deep Dive Reference
Extended reference for advanced Android device operations.
---
Advanced Logcat
Buffer Selection
adb logcat -b main # App logs (default)
adb logcat -b system # System logs
adb logcat -b crash # Crashes only
adb logcat -b radio # Telephony
adb logcat -b events # System events
adb logcat -b kernel # Kernel (like dmesg)
adb logcat -b all # EverythingOutput Formats
adb logcat -v brief # Tag and priority
adb logcat -v time # With timestamps
adb logcat -v threadtime # Time + PID + TID (recommended)
adb logcat -v long # Full metadata
adb logcat -v color # ColorizedAdvanced Filtering
# Multiple tags
adb logcat "ActivityManager:I MyApp:D *:S"
# By UID
adb logcat --uid=10123
# Since timestamp
adb logcat -T "01-25 14:00:00.000"
# Clear buffer
adb logcat -c---
Comprehensive dumpsys
Activity Manager (Most Used)
adb shell dumpsys activity activities # Activity stacks
adb shell dumpsys activity services # Running services
adb shell dumpsys activity broadcasts # Broadcast queues
adb shell dumpsys activity processes # Process list
adb shell dumpsys activity recents # Recent tasks
adb shell dumpsys activity top # Current activity
adb shell dumpsys activity lastanr # Last ANR
adb shell dumpsys activity package <pkg> # Per-package info
adb shell dumpsys activity exit-info # Exit reasons (Android 11+)Package Manager
adb shell dumpsys package <pkg> # Full package dump
adb shell dumpsys package packages # All packages
adb shell dumpsys package permissions # Permission definitions
adb shell dumpsys package features # Device features
adb shell dumpsys package dexopt # DEX optimization stateBattery & Power
adb shell dumpsys battery # Current status
adb shell dumpsys batterystats # Detailed stats
adb shell dumpsys batterystats --charged # Since last charge
adb shell dumpsys power # Wake locks
adb shell dumpsys deviceidle # Doze stateNetwork
adb shell dumpsys connectivity # Network state
adb shell dumpsys wifi # WiFi details
adb shell dumpsys netstats # Network usageGraphics & Performance
adb shell dumpsys gfxinfo <pkg> # Frame stats
adb shell dumpsys gfxinfo <pkg> framestats # Detailed timing
adb shell dumpsys meminfo <pkg> # Memory breakdown
adb shell dumpsys procstats --hours 3 # Process stats
adb shell dumpsys cpuinfo # CPU usageOther Useful Services
adb shell dumpsys notification # Notifications
adb shell dumpsys alarm # Scheduled alarms
adb shell dumpsys location # Location providers
adb shell dumpsys sensorservice # Sensors
adb shell dumpsys input # Input devices
adb shell dumpsys display # Display config
adb shell dumpsys usb # USB state
adb shell dumpsys dropbox # System crash logs---
Process Debugging
Process Inspection
adb shell ps -A # All processes
adb shell ps -A | grep <pkg> # Filter by name
adb shell ps -T -p <pid> # Threads for PID
adb shell top -n 1 -s cpu # Top by CPU
adb shell top -n 1 -s res # Top by memory/proc Filesystem
# Process status
adb shell cat /proc/<pid>/status
# Memory maps
adb shell cat /proc/<pid>/maps
# Open file descriptors
adb shell ls -la /proc/<pid>/fd
# Command line
adb shell cat /proc/<pid>/cmdline
# System memory
adb shell cat /proc/meminfo
# CPU info
adb shell cat /proc/cpuinfo---
Performance Profiling
Heap Dumps
# Java heap (for Android Studio / MAT)
adb shell am dumpheap <pid> /sdcard/heap.hprof
adb pull /sdcard/heap.hprof
hprof-conv heap.hprof heap-converted.hprof
# Native heap (requires root)
adb shell am dumpheap -n <pid> /sdcard/native.hprofMethod Tracing
adb shell am profile start <pkg> /sdcard/profile.trace
# ... perform actions ...
adb shell am profile stop <pkg>
adb pull /sdcard/profile.traceGPU Profiling
adb shell dumpsys gfxinfo <pkg>
adb shell dumpsys gfxinfo <pkg> framestats
# Enable overdraw visualization
adb shell setprop debug.hwui.overdraw show
# GPU debug layers (Vulkan)
adb shell settings put global enable_gpu_debug_layers 1
adb shell settings put global gpu_debug_app <pkg>Perfetto/Systrace
# Record system trace
adb shell perfetto --txt -c /etc/perfetto/configs/sched_trace.pbtxt \
-o /data/misc/perfetto-traces/trace.perfetto-trace
adb pull /data/misc/perfetto-traces/trace.perfetto-trace
# Open at https://ui.perfetto.dev---
Crash Analysis
Tombstones (Native Crashes)
adb shell ls -la /data/tombstones/
adb shell cat /data/tombstones/tombstone_00
adb pull /data/tombstones/Key sections:
- Signal (SIGSEGV, SIGABRT, etc.)
- Fault address
- Register state
- Backtrace
Symbolication
ndk-stack -sym /path/to/symbols -dump tombstone_00
adb logcat | ndk-stack -sym /path/to/symbolsANR Analysis
adb shell cat /data/anr/traces.txt # Older devices
adb shell cat /data/anr/anr_* # Newer devicesLook for:
- Main thread state
- Lock contention
- Long operations on main thread
DropBox Entries
adb shell dumpsys dropbox
adb shell dumpsys dropbox --print data_app_crash
adb shell dumpsys dropbox --print data_app_anr---
Network Debugging
Connection Info
adb shell cat /proc/net/tcp
adb shell cat /proc/net/udp
adb shell netstat -an # If available
adb shell ss -tunap # Modern alternativeProxy Setup
adb shell settings put global http_proxy <ip>:<port>
adb shell settings put global http_proxy :0 # RemovePacket Capture
adb shell tcpdump -i any -w /sdcard/capture.pcap
adb pull /sdcard/capture.pcap
# Open in Wireshark---
UI Automation Advanced
All Keycodes
# Navigation
KEYCODE_DPAD_UP=19, DOWN=20, LEFT=21, RIGHT=22, CENTER=23
# Media
KEYCODE_MEDIA_PLAY_PAUSE=85, NEXT=87, PREVIOUS=88
KEYCODE_VOLUME_MUTE=164
# System
KEYCODE_WAKEUP=224, KEYCODE_SLEEP=223
KEYCODE_APP_SWITCH=187 (Recent apps)
KEYCODE_SYSRQ=120 (Screenshot)Long Press
# Simulate long press with swipe of 0 distance
adb shell input swipe 500 500 500 500 1000Text with Special Characters
# Escape spaces
adb shell input text "hello%sworld" # %s = space
# For complex text, use keyboard broadcast
adb shell am broadcast -a ADB_INPUT_TEXT --es msg "Hello World!"Window Manager
adb shell wm size # Screen size
adb shell wm density # DPI
adb shell wm size 1080x1920 # Override size
adb shell wm size reset # Reset
adb shell wm overscan 0,0,0,200 # Add overscan---
Content Providers
# Query
adb shell content query --uri content://settings/system
# Insert
adb shell content insert --uri content://settings/system \
--bind name:s:my_setting --bind value:s:my_value
# Update
adb shell content update --uri content://settings/system \
--where "name='my_setting'" --bind value:s:new_value
# Delete
adb shell content delete --uri content://settings/system \
--where "name='my_setting'"
# Common URIs
content://contacts/people
content://sms/inbox
content://settings/system
content://settings/secure
content://settings/global---
Service Calls
adb shell service list # List services
adb shell service call <service> <code> # Call service methodcmd Interface (Android 8+)
adb shell cmd -l # List services
adb shell cmd package list packages
adb shell cmd activity start -n <component>
adb shell cmd statusbar expand-notifications
adb shell cmd battery set level 50---
Developer Options via ADB
# Stay awake while charging
adb shell settings put global stay_on_while_plugged_in 3
# Show touches
adb shell settings put system show_touches 1
# Pointer location
adb shell settings put system pointer_location 1
# Animation scales (0 = off, good for testing)
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
# Force GPU rendering
adb shell settings put global force_gpu true---
Emulator-Specific
# Telnet to emulator console
telnet localhost 5554
# In console:
sms send 5551234567 "Hello"
geo fix -122.084 37.422
power capacity 50
network speed gsm---
Quick Diagnostics Script
#!/bin/bash
# android-diag.sh - Quick device diagnostics
echo "=== Device Info ==="
adb shell getprop ro.product.model
adb shell getprop ro.build.version.release
echo "=== Memory ==="
adb shell cat /proc/meminfo | head -5
echo "=== Storage ==="
adb shell df -h /data
echo "=== Battery ==="
adb shell dumpsys battery | grep -E "level|status|health"
echo "=== Top Processes ==="
adb shell top -n 1 -m 5 -s res
echo "=== Recent Crashes ==="
adb logcat -b crash -d -t 10 2>/dev/null || echo "No recent crashes"