/android-emulator-skill:android-emulator-skillfrom android-emulator-skill
Drives Android emulators and devices from the shell: builds apps with Gradle, launches them, taps and types by UI label, reads logcat, audits accessibility, and manages emulator lifecycle. Scripts over adb, uiautomator, and Gradle wrapper.
Ships in android-emulator-skill. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Build, test and drive Android apps by what is on the screen, not by pixel coordinates. Each
script answers in a few lines; --json gives the answer as JSON (its shapes: Failures).
Scripts live in scripts/, beside this file. Use a path rooted at the skill
directory, not a bare relative path — when the skill is installed as a plugin
and you are working in a project, python scripts/foo.py is a file-not-found.
SKILL_DIR=/path/to/skills/android-emulator-skill
python3 "$SKILL_DIR/scripts/screen_mapper.py" --json
Every example here and in references/ is written with $SKILL_DIR set that way.
Which device. A script that talks to a device takes --serial. Without it the one
attached device is used; several attached and no --serial is a refusal (exit 1), and
none is exit 3. An entry says so where its script differs.
# 0. Check the environment (exit 1 names what to fix: adb, a JDK below 17, ...)
bash "$SKILL_DIR/scripts/android_health_check.sh" --json
# 1. Launch app
python3 "$SKILL_DIR/scripts/app_launcher.py" --launch com.example.app
# 2. Map screen to see elements
python3 "$SKILL_DIR/scripts/screen_mapper.py"
# 3. Tap button (add --scroll-to-find if it may be below the fold)
python3 "$SKILL_DIR/scripts/navigator.py" --find-text "Login" --tap
# 4. Enter text
python3 "$SKILL_DIR/scripts/navigator.py" --find-type EditText --enter-text "[email protected]"
# 5. Run accessibility audit
python3 "$SKILL_DIR/scripts/accessibility_audit.py"
All scripts support --help for detailed options and --json for machine-readable output.
Two handoffs carry most tasks. In each, one command prints the value the next one takes: pass it back whole, as printed.
See, act, verify. screen_mapper.py names the controls on the screen. Hand one of
those names to navigator.py, then map again: the screen that comes back is the check
that the action did what was meant.
python3 "$SKILL_DIR/scripts/screen_mapper.py"
python3 "$SKILL_DIR/scripts/navigator.py" --find-text "Submit Order" --tap
python3 "$SKILL_DIR/scripts/screen_mapper.py"
Not found on a screen that scrolls: add --scroll-to-find. A control with no name:
--find-type, --find-id, and --tap-at x,y last.
Build, then diagnose. build_and_test.py prints a summary line ending in a build id
and, when the build failed, its first errors. Pass the id back for the rest (--get-errors,
--get-warnings, --get-log); do not run the build again to read them.
python3 "$SKILL_DIR/scripts/build_and_test.py" --project .
python3 "$SKILL_DIR/scripts/build_and_test.py" --get-errors build-20251028-143052-1a2b3c4d
Each entry: what the script is for, one command to start from, its flags, and a link to its detail (modes, output, failures). Read the detail file before a mode you have not used.
common/)Shared by the scripts and not run directly: adb_exec, anr_pipeline, anr_sessions, batch, cache_utils, cli, device_utils, dump_read, emu_console, env_config, hierarchy, log_lifecycle, logcat, run_as, screenshot_utils, sdk_tools.
python3 "$SKILL_DIR/scripts/app_launcher.py" --launch com.example.app--launch and --open-url wait for the activity and fail unless the system reports Status: ok.--launch, --restart, --activity, --args KEY=VALUE, --terminate, --install, --uninstall, --open-url, --list, --filter, --state, --serial/-s, --jsonemulator_boot.py - Boot an AVD, and wait until it is ready when asked.
python3 "$SKILL_DIR/scripts/emulator_boot.py" --avd Pixel_9 --wait-ready--avd, --all, --wait-ready, --timeout, --headless, --list-avds, --jsonemulator_shutdown.py - Shut down a running emulator. Emulators only: any other serial is refused before adb runs.
python3 "$SKILL_DIR/scripts/emulator_shutdown.py" --serial emulator-5554--serial, --name or --all: it never picks a device by itself.--serial, --name, --verify/--no-verify, --timeout, --all, --jsonemulator_create.py - Create an AVD from a device definition and an API level.
python3 "$SKILL_DIR/scripts/emulator_create.py" --device pixel_7 --api 34 --name test-device--list-images says which are. A Python running under Rosetta needs --abi arm64-v8a.--device, --api, --name, --abi, --variant, --list-devices, --list-images, --jsonemulator_delete.py - Delete an AVD for good. Destructive.
python3 "$SKILL_DIR/scripts/emulator_delete.py" --name test-device --yes--yes it asks on stderr and reads the answer from stdin. --old N keeps the newest N by config modification time; N is not an age.--name, --all, --old, --yes, --list, --json, --verboseemulator_erase.py - Factory-reset an AVD: wipe its data, keep the AVD. Destructive.
python3 "$SKILL_DIR/scripts/emulator_erase.py" --name test-device --verify--force erases anyway). Snapshots are kept.--name, --all, --force, --verify, --timeout, --list, --json, --verbosebuild_and_test.py - Build with the project's Gradle wrapper, run unit or instrumented tests, and read a build's errors back by its id.
python3 "$SKILL_DIR/scripts/build_and_test.py" --project . --test--instrumented runs on one device.--project, --module/-p, --variant, --clean, --test, --instrumented, --suite, --serial, --get-errors/--get-warnings/--get-log <ID>, --list-builds, --verbose, --jsonlog_monitor.py - Read logcat for one app or the whole device: a time window, a live read, or history.
python3 "$SKILL_DIR/scripts/log_monitor.py" --app com.example.app --duration 30s --severity error,warning--duration and --last need a unit (30s, 5m). An app with no process in the window is refused.--app, --serial, --severity, --follow, --duration, --last, --output, --clear, --verbose, --jsonscreen_mapper.py - See the current screen: names its interactive controls. Run it first, and again after acting.
python3 "$SKILL_DIR/scripts/screen_mapper.py"--verbose breakdown up to 10; --json holds the uncapped analysis.--serial/-s, --verbose/-v, --hints, --jsonnavigator.py - Find a control by a name screen_mapper printed, by type or by id, then tap it or type into it.
python3 "$SKILL_DIR/scripts/navigator.py" --find-text "Login" --tap--scroll-to-find to search below the fold.--wait-for TEXT waits for text; --tap --expect TEXT taps, waits, then prints the screen that followed.--find-text, --find-exact, --exact, --find-type, --find-id, --index, --tap, --enter-text, --tap-at x,y, --wait-for TEXT, --expect TEXT, --timeout S, --list, --scroll-to-find, --scroll-direction {down,up}, --max-scrolls N, --serial, --json, --verbosegesture.py - Swipe, scroll, drag, long-press, pull to refresh.
python3 "$SKILL_DIR/scripts/gesture.py" --scroll down--scroll names where the content moves, --swipe what the finger does: opposites.--swipe, --from-edge, --swipe-path, --drag, --refresh, --duration, --long-press, --scroll, --count, --serial, --jsonkeyboard.py - Type text, press keys and hardware buttons, put the keyboard away.
python3 "$SKILL_DIR/scripts/keyboard.py" --type "hello"--button back presses BACK; --hide-keyboard presses it only when a keyboard is shown.--type, --delay, --key, --count, --keys, --button, --clear, --hide-keyboard, --dismiss, --serial/-s, --jsonaccessibility_audit.py - Audit the current screen: unlabelled controls, small touch targets, missing hints.
python3 "$SKILL_DIR/scripts/accessibility_audit.py"--serial, --output, --verbose, --jsonvisual_diff.py - Compare two screenshots and pass or fail against a pixel threshold.
python3 "$SKILL_DIR/scripts/visual_diff.py" baseline.png current.png --threshold 0.01--output, --threshold, --json, --detailstest_recorder.py - Document a test run step by step: a screenshot and the hierarchy per step, a report at the end.
python3 "$SKILL_DIR/scripts/test_recorder.py" --start "Login flow"--step TEXT after each interaction and --stop; one command at a time per session.--start, --step, --stop, --list, --get-details, --clear, --session, --serial, --app-name, --size, --screen, --state, --assert, --assert-failed, --failed, --older-than, --verbose, --jsonapp_state_capture.py - Capture a debugging snapshot: screenshot, hierarchy, the app's own logs, app info.
python3 "$SKILL_DIR/scripts/app_state_capture.py" --package com.example.app--output says so.--package, --output, --serial, --logs, --no-logs, --log-lines, --screenshot-size, --json, --verboseprivacy_manager.py - Grant, revoke or list an app's runtime permissions.
python3 "$SKILL_DIR/scripts/privacy_manager.py" --package com.example.app --grant camera,location--list-permissions names the permissions it knows.--grant, --revoke, --reset, --list, --package, --user, --serial, --list-permissions, --json, --verbosestatus_bar.py - Set what the status bar draws (battery, signal, clock) for stable screenshots.
python3 "$SKILL_DIR/scripts/status_bar.py" --preset clean--reset ends it.--preset, --battery, --charging, --wifi, --wifi-level N, --mobile, --mobile-level N, --mobile-type TYPE, --time, --reset, --serial, --json, --verbosepush_notification.py - Post a notification into the shade as the shell, and read back what any package has posted.
python3 "$SKILL_DIR/scripts/push_notification.py" --post --tag "Title" --text "Body"--post, --list, --grant-permission, --revoke-permission, --tag, --text, --no-verify, --expect-package, --package, --serial, --json, --verboseandroid_health_check.sh - Check the environment before anything else: SDK tools, JDK 17 or newer, Python, devices, AVDs.
bash "$SKILL_DIR/scripts/android_health_check.sh" --json--json, --helpdevice_list.py - List attached devices and defined AVDs.
python3 "$SKILL_DIR/scripts/device_list.py"--get-details, --device-type/--name, --jsonemulator_selector.py - Suggest which AVD to use, list them, or boot one.
python3 "$SKILL_DIR/scripts/emulator_selector.py" --suggest--suggest, --list, --boot NAME, --headless, --count, --json, --verboselocalization_audit.py - Audit strings.xml: keys missing per locale, placeholder and plural mismatches.
python3 "$SKILL_DIR/scripts/localization_audit.py" --res app/src/main/res--strict exits 2 on findings.--res DIR, --source DIR, --locale CODE, --strict, --json, --verboseappearance.py - Switch dark or light theme and the font scale.
python3 "$SKILL_DIR/scripts/appearance.py" --theme dark--reset restores the defaults.--theme {light,dark}, --text-size {small,default,large,xl}, --font-scale, --locale, --reset, --serial, --json, --verboselocation.py - Set an emulator's GPS position: coordinates, a city preset, or a GPX route. Emulator only.
python3 "$SKILL_DIR/scripts/location.py" --city london--lat/--lng, --city, --gpx FILE, --interval/--speed, --clear, --list-cities, --serial, --json, --verbosecontainer.py - Inspect a debuggable app's files: list, read, shared preferences, databases, export.
python3 "$SKILL_DIR/scripts/container.py" --package com.example.app --lsrun-as); a release build is refused by name.--package (all but --get-cached), --ls [SUBPATH], --cat FILE, --shared-prefs [NAME], --databases [NAME], --export DIR, --get-cached ID, --serial, --json, --verbosemodel_inspector.py - Inspect persistence: Room entities in source, Room's exported schema, or a live app's SQLite schema.
python3 "$SKILL_DIR/scripts/model_inspector.py" --source app/src/main/java--package reads a live, debuggable app; the other two read files.--source DIR, --schema PATH, --show-versions, --raw NAME, --package, --db NAME, --serial, --json, --verboseanr_watcher.py - Find ANRs and jank in logcat: a window of history, a live watch, or a session around a test.
python3 "$SKILL_DIR/scripts/anr_watcher.py" --since 5m--start prints an id, --stop ID the summary. macOS and Linux only.--watch, --since, --start, --stop, --get-details, --list-sessions, --clear-sessions, --diff, --package, --serial, --duration, --min-frames, --top, --all, --budget-tokens, --cluster, --raw, --older-than, --terse, --abandon, --jsonsms.py - Deliver an inbound SMS to an emulator and confirm it arrived; extract a one-time code from the inbox.
python3 "$SKILL_DIR/scripts/sms.py" --send --to 5551234567 --body "Your code is 123456"--send is emulator only.--send --to NUM --body TEXT [--no-verify], --list [--limit N], --otp, --serial, --json, --verbosesnapshot.py - Save, load or delete an emulator snapshot: a state reset in about 2 s. Emulator only.
python3 "$SKILL_DIR/scripts/snapshot.py" --save clean-state--list, --save NAME, --load NAME, --delete NAME, --no-verify, --timeout, --serial, --json, --verbosecrash_triage.py - Read the crash buffer as structured crashes, grouped by fault.
python3 "$SKILL_DIR/scripts/crash_triage.py" --package com.example.appcrash_count, or pass --fail-on-crash.--package PKG, --clear, --fail-on-crash, --serial, --json, --verboselogs.py - One entry point for reading logs: tail (log_monitor.py), crashes (crash_triage.py), anr (anr_watcher.py).
python3 "$SKILL_DIR/scripts/logs.py" crashes<verb> [verb options], --json (routing table), --helpavd.py - One entry point for the emulator lifecycle: list, pick, create, start, stop, reset, delete.
python3 "$SKILL_DIR/scripts/avd.py" list<verb> [verb options], --json (routing table), --helpbuild_and_test.py, android_health_check.sh
and anr_watcher.py are known not to run there (see Known gaps below)# 1. Install Android SDK (via Android Studio or command line tools)
# Download from: https://developer.android.com/studio
# 2. Set environment variables
export ANDROID_HOME=$HOME/Library/Android/sdk # macOS
export PATH=$PATH:$ANDROID_HOME/platform-tools
export PATH=$PATH:$ANDROID_HOME/emulator
# 3. Verify installation
adb version
emulator -version
# As a plugin (preferred; updating is then two commands -- see README.md)
claude plugin marketplace add fluxxion82/android-emulator-skill
claude plugin install android-emulator-skill@fluxxion82
# From a clone: the skill is the INNER directory (this file's own), not the
# repository root, so clone the repo and link that directory into place.
git clone https://github.com/fluxxion82/android-emulator-skill ~/src/android-emulator-skill
# Personal installation
mkdir -p ~/.claude/skills
ln -s ~/src/android-emulator-skill/android-emulator-skill/skills/android-emulator-skill ~/.claude/skills/android-emulator-skill
# Project installation
mkdir -p .claude/skills
ln -s ~/src/android-emulator-skill/android-emulator-skill/skills/android-emulator-skill .claude/skills/android-emulator-skill
known-gaps.md, what the skill does not do yet (ships with the package)In the source repository only (not included in the released package):
The clipboard is not reachable from adb. There is no way to set clipboard text from the shell on any modern Android:
cmd clipboard reports "No shell command implementation" on API 33 and 35 —
the clipboard service exposes no shell command interface at all.service call clipboard <setPrimaryClip> cannot work either: the call takes a
ClipData Parcelable, whose text is marshalled with writeString8() plus
version-dependent fields, and service can only write i32/s16/binders.adb emu) has no clipboard command.Reading and clearing are reachable — service call clipboard 3/4/9 with the
right signature is accepted for the shell uid, which holds
READ_CLIPBOARD_IN_BACKGROUND — but writing is not, so a paste-flow test needs
an app-side hook or a helper IME.
On an emulator only, the gRPC control API does expose setClipboard /
getClipboard (see $ANDROID_HOME/emulator/lib/emulator_controller.proto).
That needs a gRPC client and the emulator's auth token, and is not wired up here.
clipboard.py was removed in v0.6.0 for this reason: its surviving code path
called service call clipboard 1 with the pre-Android-10 signature and always
failed.
Jetpack Compose screens look different in the dump. Everything below was measured from recorded dumps of a real Compose app, not assumed — three plausible-sounding assumptions about Compose turned out to be wrong.
androidx.compose.ui.platform.ComposeView.
AndroidComposeView does not appear in the dump at all, so a detector
looking for it matches nothing.android:id/content, which belongs to the AOSP FrameLayout. --find-id has
nothing to work with; use --find-text or screen_mapper.text="" and content-desc="". uiautomator dumps the
unmerged semantics tree, so a clickable Card keeps its Texts as separate
children rather than merging them into one label — there is no concatenation
anywhere. screen_mapper recovers labels from a control's descendants
(Button, Card, list row) and from row-adjacent siblings (Checkbox, Switch,
icon), which is why it can name a control that the dump leaves anonymous.To make your own Compose app addressable, opt into test tags as resource-ids on the root of the tree:
Modifier.semantics { testTagsAsResourceId = true } // once, at the root
Modifier.testTag("submit_button") // on each control
The tag then surfaces as a bare resource-id — submit_button, not
com.example.app:id/submit_button. Anything that splits a resource-id on
":id/" to recover a name drops every Compose tag on the screen.
Every script ends in cli.run(main) (common/cli.py), so a failure has one
shape whichever script met it. What is promised, and what is not yet:
adb or SDK tool, an adb call that failed, a
screen that would not dump, a timeout, or a failure a script raises with
cli.fail — answers {"success": false, "error": ..., "remedy": ...} on
one line of stdout under --json, Error: / Remedy: on stderr
otherwise, and exits 1. A refusal that found something on the way may
carry it as extra keys after those three (a lookup's search, a capture's
partial, the entries a listing could read); the three are always there.--serial resolution noticed or adb
did mid-run. Several devices and no --serial is 1.avd.py / logs.py verb — exits 2 and is the same object
under --json: one line on stdout, error argparse's message, remedy
the usage line (for an unknown verb, the verbs). Inside a router verb it
is the delegate's own (avd.py list --bogus --json). Without --json it
is argparse's prose on stderr (the route guide for an unknown verb).
--json after -- is a positional value, not the flag.crash_triage --fail-on-crash and
localization_audit --strict exit 2 when they find something, and
accessibility_audit exits 1 when a critical issue is present.log_monitor --follow, anr_watcher --watch) cannot
take back the records it already printed: there the refusal object is the
last line of stdout, and parses on its own. anr_watcher --since --json is JSON Lines as well, like --watch --json: one object per
event, no enclosing document, so read it line by line (a single-document
parse fails at the second event). anr_watcher --get-details ID --raw
prints the session's stored event lines (events.jsonl, an abandoned
session's up to its fence), with or without --json: JSON Lines too.
Every other mode keeps stdout to one
JSON document under --json (emulator_delete's confirmation prompt
goes to stderr). A refusal is always the object; a successful listing is
an array instead in five modes: build_and_test --get-errors,
--get-warnings and --list-builds, test_recorder --list, and
anr_watcher --list-sessions.emulator_boot), the snapshot
save/delete verify poll (snapshot, which keeps asking until its deadline
and then reports the device as unavailable), the optional
foreground-activity lookup (device_utils.get_current_activity), the
emulator-console survey (emu_console), and the partial-capture policy of
test_recorder steps and app_state_capture (what arrived is kept and
handed over -- by app_state_capture in a refusal that is still exit 3
when the device was unavailable), and anr_watcher's attribution lookups
(system_server's pid, the package's uids, a live pid's uid and the whole
uid table, each an unknown answer on failure, disclosed as unattributed or
unknown attribution rather than ending a read or a session).tests/test_exit_code_sweep.py runs every
Quick Start command and the modes its table lists twice — with the Android
tools present and failing, and with none on PATH at all — and
asserts the refusal itself (one object, or Error: / Remedy:; an error
naming the tool; the exact status), not just a non-zero exit. In all it
asserts the payload of 42 documented modes, each of them twice. It runs a
usage error through every script in both modes too, and fails if a
script on disk is missing from that run (android_health_check.sh
included; its object carries ok as well, like its other answers).status_bar and
appearance, per permission in privacy_manager's grant/revoke/reset,
per AVD or emulator in emulator_boot / emulator_shutdown /
emulator_erase --all and emulator_delete --all / --old
(common/batch.py) — is one object: success false when ANY item failed,
then error and remedy as above, the batch's own keys, and items,
each item its own fields plus success, error, remedy (null when it
succeeded). Exit 0 only when every item succeeded, 1 when one failed; a
batch whose every item failed is still that one object. Breaking in
v0.9.0: each of these printed results (or, emulator_shutdown,
counts only); it is items now. In a one-device batch (status_bar,
appearance, privacy_manager) a device that goes away stops the batch
at the item that met it: that item carries the device error, every item
after it says not attempted, and the object exits 3 (1 for several
devices and no --serial). In the emulator_* batches each item is its
own emulator, so one that vanished is that item's failure and the rest
still run. (anr_watcher --all keeps every ANR cluster; it is not a
batch.)container and
model_inspector ask run_argv for it with confirm_device_errors): their
stderr is a device command's, and a file name can print an adb: … line.
logcat's readers do not ask: that stderr is adb's own, and a probe finding
the device a moment later turned a real device error into exit 1. Of the
run_adb callers whose arguments are agent-supplied, three print that
text back on stderr where a forged adb: device ... not found line would
read as adb's own, and ask run_adb for the same confirmation:
privacy_manager's pm grant / pm revoke (an unknown permission's
name), appearance --locale (setprop names the value it refused) and
app_launcher --install (adb's own adb: failed to stat <path>). These
were recorded alongside them (tests/record_fixtures.py, the *_echo
fixtures), and their text comes back on stdout, or not at all, so it is
never classified: privacy_manager's dumpsys package; app_launcher's
launch, --open-url, --terminate, --uninstall and launcher lookup;
device_utils' pm dump and package-uid lookup; pidof (log_monitor's
stream path, app_state_capture, app_launcher --state) and
app_state_capture's version probe; status_bar --mobile-type;
keyboard / navigator input text; and push_notification --post. The probe cannot tell such an echo from a real loss followed
by a recovery before it, so a caller whose stderr is adb's alone does not
ask.accessibility_audit; anr_watcher --package attribution for isolated,
app-zygote and SDK-sandbox processes, or for a package installed,
reinstalled or given another user during the read; an ANR session without
--package naming an app that was already running; a log capture as proof
that a window is complete; build_and_test --instrumented beyond one
device and one variant, or on a results layout other than the two recorded;
writing the clipboard.CHANGELOG.md at the root of the source repository
(https://github.com/fluxxion82/android-emulator-skill). It does not ship
with the skill.README.md (opens in a new tab)agents/openai.yaml (opens in a new tab)examples/login_flow_example.sh (opens in a new tab)references/accessibility_audit.md (opens in a new tab)references/android_health_check.md (opens in a new tab)references/anr_watcher.md (opens in a new tab)references/app_launcher.md (opens in a new tab)references/app_state_capture.md (opens in a new tab)references/appearance.md (opens in a new tab)references/avd.md (opens in a new tab)references/build_and_test.md (opens in a new tab)references/container.md (opens in a new tab)references/crash_triage.md (opens in a new tab)references/device_list.md (opens in a new tab)references/emulator_boot.md (opens in a new tab)references/emulator_create.md (opens in a new tab)references/emulator_delete.md (opens in a new tab)references/emulator_erase.md (opens in a new tab)references/emulator_selector.md (opens in a new tab)references/emulator_shutdown.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
android-emulator, adb, uiautomator, gradle, logcat, accessibility-audit
npx claudepluginhub fluxxion82/android-emulator-skill --plugin android-emulator-skillOther plugins' skills for the same job