Devices, Emulators & Debugging
Device Discovery
Section titled “Device Discovery”List Connected Devices
Section titled “List Connected Devices”List my connected Android devices
Shows all physical devices and running emulators with their serial numbers and status.
Get Device Details
Section titled “Get Device Details”Get info about my connected device
Returns model, manufacturer, Android version, API level, screen density, resolution, and more.
Quick Device Checks
Section titled “Quick Device Checks”Run “getprop ro.build.version.release” on my device
Run “df -h /data” to check available storage
Run “cat /proc/meminfo” to see memory info
Emulator Lifecycle
Section titled “Emulator Lifecycle”Create an Emulator
Section titled “Create an Emulator”Create an Android 35 emulator called TestDevice
Create an emulator called Pixel7_API34 with a Pixel 7 Pro device profile and API 34
Create an emulator called TestDevice with API 35, overwriting if it exists
Start with Options
Section titled “Start with Options”Start the TestDevice emulator
Start the emulator with cold boot
Ignores saved snapshots — useful when the emulator is in a bad state.
Start the emulator in headless mode
No GUI window — perfect for CI/CD.
Start the emulator and wipe all data
Factory reset before starting.
Stop an Emulator
Section titled “Stop an Emulator”Stop the running emulator
Stop emulator-5554
Multi-Device Testing
Section titled “Multi-Device Testing”-
Create two emulators for different API levels
Create an Android 28 emulator called API28_Test
Create an Android 35 emulator called API35_Test
-
Start the first one and test
Start the API28_Test emulator
-
After testing, stop and switch
Stop the running emulator
Start the API35_Test emulator
App Installation & Management
Section titled “App Installation & Management”Install
Section titled “Install”Install my debug APK on the device
Install the APK at ./app/build/outputs/apk/debug/app-debug.apk
Reinstall (keep data)
Section titled “Reinstall (keep data)”Reinstall the APK keeping existing data
Useful for testing upgrades without losing app state.
Launch
Section titled “Launch”Launch com.example.myapp
Launch the DetailActivity of com.example.myapp
Stop and Clear
Section titled “Stop and Clear”Force stop com.example.myapp
Clear all data for com.example.myapp
This is equivalent to “Clear Storage” in Android Settings.
Full Install-to-Screenshot Cycle
Section titled “Full Install-to-Screenshot Cycle”-
Build the project
Build my Android project
-
Install the APK
Install my debug APK
-
Launch the app
Launch com.example.myapp
-
Take a screenshot to verify
Take a screenshot of my device
Permission Management
Section titled “Permission Management”List Permissions
Section titled “List Permissions”List all permissions for com.example.myapp
Shows every permission with its granted/denied status.
Grant Permissions
Section titled “Grant Permissions”Grant camera permission to com.example.myapp
Grant android.permission.ACCESS_FINE_LOCATION to com.example.myapp
Grant android.permission.RECORD_AUDIO to com.example.myapp
Grant android.permission.READ_EXTERNAL_STORAGE to com.example.myapp
Revoke for Testing
Section titled “Revoke for Testing”Revoke camera permission from com.example.myapp
Revoke all location permissions from com.example.myapp
Test Permission-Denied Scenarios
Section titled “Test Permission-Denied Scenarios”-
Revoke the permission
Revoke camera permission from com.example.myapp
-
Clear the app data to reset “Don’t ask again” state
Clear all data for com.example.myapp
-
Launch the app
Launch com.example.myapp
-
Take a screenshot to verify the permission dialog
Take a screenshot
Logcat Mastery
Section titled “Logcat Mastery”Basic Reading
Section titled “Basic Reading”Show the last 100 logcat lines
Show the last 500 log lines
Filter by Priority
Section titled “Filter by Priority”| Priority | Prompt |
|---|---|
| Errors only | ”Show error logs from my device” |
| Warnings and above | ”Show logcat with Warning priority” |
| Info and above | ”Show logcat with Info priority” |
| Everything | ”Show verbose logcat” |
Filter by Tag
Section titled “Filter by Tag”Show logcat for tag MyApp
Show logcat for tag CrashReporter with Error priority
Search for Exceptions
Section titled “Search for Exceptions”Search logcat for NullPointerException
Search logcat for OutOfMemoryError
Search logcat for ANR
Search logcat for FATAL
Search logcat for “Unable to start activity”
Time-Based Filtering
Section titled “Time-Based Filtering”Show logs since 2025-01-15 10:30:00
Show error logs since 2025-01-15 14:00:00.000
Combined Filters
Section titled “Combined Filters”Show the last 200 error logs for tag CrashHandler containing “fatal”
Show warning logs for tag NetworkClient containing “timeout” since 10:00:00
Clear and Start Fresh
Section titled “Clear and Start Fresh”Clear the logcat buffer
Then reproduce the bug:
Show error logs from my device
Visual Debugging
Section titled “Visual Debugging”Screenshots
Section titled “Screenshots”Take a screenshot of my device
Capture a screenshot and save to ~/Desktop/bug-report.png
Take a screenshot and save to ./screenshots/login-screen.png
Screen Recording
Section titled “Screen Recording”Record my device screen for 10 seconds
Record my device screen for 30 seconds and save to ~/Desktop/demo.mp4
Record a 60-second video of my device
UI Hierarchy Dump
Section titled “UI Hierarchy Dump”Dump the UI hierarchy of the current screen
Returns XML with every view element, its bounds, text content, content description, and click/focus state. Invaluable for:
- Finding views that aren’t visible
- Debugging layout overlap issues
- Verifying accessibility labels
- Understanding third-party UI components
Combined Visual Debug
Section titled “Combined Visual Debug”-
Screenshot the current state
Take a screenshot
-
Dump the UI tree
Dump the UI hierarchy
-
Check logcat for errors
Show error logs from my device
-
Get memory info
Run “dumpsys meminfo com.example.myapp” on the device
Shell Commands
Section titled “Shell Commands”Package Management
Section titled “Package Management”Run “pm list packages” on my device
Run “pm list packages -3” to show third-party apps only
Run “pm path com.example.myapp” to find the APK path
System Information
Section titled “System Information”Run “df -h” to check disk space
Run “cat /proc/meminfo” for memory info
Run “getprop ro.build.version.release” for Android version
Run “ip addr show wlan0” to get device IP address
Performance Profiling
Section titled “Performance Profiling”Run “dumpsys meminfo com.example.myapp” on the device
Run “dumpsys cpuinfo” to check CPU usage
Run “dumpsys battery” to check battery stats
Run “dumpsys activity top” to see the current foreground activity
Run “dumpsys gfxinfo com.example.myapp” for frame rendering stats
Force GC and Trim
Section titled “Force GC and Trim”Run “am send-trim-memory com.example.myapp COMPLETE” on the device
WiFi ADB & File Transfer
Section titled “WiFi ADB & File Transfer”WiFi ADB Setup
Section titled “WiFi ADB Setup”- Connect your device via USB
- Switch to WiFi mode
Connect to my device over WiFi ADB
- Unplug the USB cable — the device stays connected wirelessly
- When done:
Disconnect WiFi ADB
Push Files to Device
Section titled “Push Files to Device”Push test-data.json to /sdcard/Download/ on the device
Push config.xml to /sdcard/Android/data/com.example.myapp/files/
Pull Files from Device
Section titled “Pull Files from Device”Pull /data/data/com.example.myapp/databases/app.db from the device
Pull /sdcard/Download/crash-log.txt to ./debug/
Pull /data/data/com.example.myapp/shared_prefs/ from the device
Common Device Paths
Section titled “Common Device Paths”| Path | Contents |
|---|---|
/sdcard/Download/ | Downloads folder |
/sdcard/DCIM/ | Camera photos |
/sdcard/Pictures/Screenshots/ | Device screenshots |
/data/data/<package>/databases/ | App databases |
/data/data/<package>/shared_prefs/ | SharedPreferences XML |
/data/data/<package>/files/ | Internal file storage |
/data/data/<package>/cache/ | App cache |