askill
android-adb

android-adbSafety 90Repository

Automate ADB commands for device management, app installation, and log analysis. Use when listing devices, installing APKs, viewing logs, debugging app issues, or capturing screenshots.

0 stars
1.2k downloads
Updated 2/5/2026

Package Files

Loading files...
SKILL.md

Android ADB Skill

Automate ADB commands for device management, app installation, and log analysis.

When to Use

  • Listing connected devices
  • Installing/uninstalling APKs
  • Viewing application logs
  • Debugging app issues
  • Capturing screenshots/screen recordings

Commands

Device Management

CommandDescriptionADB Command
devicesList connected devicesadb devices -l
restartRestart ADB serveradb kill-server && adb start-server

App Management

CommandDescriptionADB Command
installInstall APKadb install -r app.apk
uninstallRemove appadb uninstall com.package.name
clearClear app dataadb shell pm clear com.package.name
startLaunch appadb shell am start -n pkg/.Activity
stopForce stop appadb shell am force-stop com.package.name

Logcat Commands

CommandDescriptionADB Command
logView all logsadb logcat -v threadtime
log:appApp logs onlyadb logcat --pid=$(adb shell pidof pkg)
log:tagFilter by tagadb logcat -s TAG_NAME
log:errorErrors onlyadb logcat *:E
log:clearClear log bufferadb logcat -c

Debug Commands

CommandDescriptionADB Command
screenshotCapture screenadb exec-out screencap -p > screen.png
screenrecordRecord screenadb shell screenrecord /sdcard/video.mp4
anrCheck ANR tracesadb pull /data/anr/traces.txt
crashGet crash logsadb logcat -b crash

Logcat Patterns

# Filter by specific tags (common managers)
adb logcat -s GameManagerImpl AuthService SyncManager

# Compose errors
adb logcat | grep -i "compose\|recomposition"

# Coroutine exceptions
adb logcat | grep "CoroutineException\|JobCancellationException"

# ANR detection
adb logcat | grep -i "ANR\|Application Not Responding"

# Timber logs (class name as tag)
adb logcat | grep -E "(GameManager|UserManager|AuthService)"

Usage Examples

# Install and launch debug build
adb install -r app/build/outputs/apk/debug/app-debug.apk
adb shell am start -n com.creative.aiquiz/.LauncherActivity

# Clear app data and restart
adb shell pm clear com.creative.aiquiz
adb shell am start -n com.creative.aiquiz/.LauncherActivity

# Monitor specific logs
adb logcat -s GameManagerImpl:V

# Capture crash on error
adb logcat *:E -d > crash_log.txt

# Take screenshot for bug report
adb exec-out screencap -p > screenshot.png

Error Handling

# Check device connection
adb devices -l || (adb kill-server && adb start-server && adb devices -l)

# Handle installation errors
adb install -r app.apk 2>&1 | grep -q "INSTALL_FAILED" && {
    echo "Installation failed - checking signature..."
    adb uninstall com.package.name
    adb install app.apk
}

# Parse crash from logcat
adb logcat -b crash -d | grep -A 20 "FATAL EXCEPTION"

Common Errors:

  • Device not found: Enable USB debugging in Developer Options
  • Installation failed: Uninstall conflicting version first
  • Permission denied: Device needs root or debugging enabled
  • Unauthorized: Approve computer on device prompt

Troubleshooting

IssueCommand
Device offlineadb kill-server && adb start-server
Multiple devicesadb -s SERIAL_NUMBER shell
App not startingadb shell am start -D -n pkg/.Activity
Screen frozenadb shell input keyevent 26
Storage fulladb shell df -h

Command Workflows

# Full debug cycle
adb logcat -c && \
./gradlew installDebug && \
adb shell am start -n com.pkg/.MainActivity && \
adb logcat -s MainActivity:V

# Capture crash report
adb logcat -b crash -d > crash.txt && \
adb bugreport > bugreport.zip

# Monitor specific feature
adb logcat -c && adb logcat -s GameManager AuthService SyncManager

CI/CD Integration

# Firebase Test Lab
- name: Run Instrumented Tests
  run: |
    gcloud firebase test android run \
      --type instrumentation \
      --app app-debug.apk \
      --test app-debug-androidTest.apk

Best Practices

  • Prefer filtered logs to avoid overwhelming output
  • Use -d flag to dump existing logs and exit
  • Clear logcat before reproducing issues
  • Use Timber tags consistently (class name)

References

Install

Download ZIP
Requires askill CLI v1.0+

AI Quality Score

95/100Analyzed 2/12/2026

A comprehensive and well-structured reference for Android ADB commands, covering device management, logging, debugging, and automation workflows with clear examples and error handling.

90
95
100
95
95

Metadata

Licenseunknown
Version1.0.0
Updated2/5/2026
Publishermajiayu000

Tags

ci-cdpromptingtesting