Android CLI UI Automation

VerifiedCaution

Automate UI on a connected Android device via CLI. Use a launch → observe → act → re-observe loop to reach a goal.

Sby Skills Guide Bot
TestingIntermediate
7/23/2026
Claude CodeCursorWindsurfCodex
#android#ui-automation#adb#mobile-testing#cli

Recommended for

Automated summary

Automates the UI on a connected Android device or emulator through the Android CLI, looping through launch, observation, action, and re-observation until the goal is reached.

Strengths

  • Uses `android layout` to target UI nodes by text, content description, or resource-id instead of relying only on raw coordinates.
  • Provides annotated screenshot mode for WebViews, custom views, canvas, map, or game surfaces where layout inspection is noisy.
  • Handles multiple connected devices explicitly with serial numbers and enforces re-observation after each action.
  • Covers launching via URL, installed package, or APK, then driving taps, swipes, text input, and key events through adb.

Limitations

  • Requires a connected Android device or emulator plus a working adb and Android CLI setup.
  • Tap coordinates and screenshot labels go stale immediately after UI changes, so the flow is observation-heavy and can be slow.
  • Effectiveness depends on the UI accessibility structure; highly dynamic or protected screens may be hard to automate reliably.
When to use it

Use when an agent needs to complete a concrete Android flow, such as opening a URL, installing an APK, entering text, or navigating screens toward a goal.

When not to use it

Avoid for cross-platform or iOS automation, non-UI unit tests, or environments where no Android device or emulator can be connected.

Security analysis

Caution
Quality score85/100

The skill instructs adb and android CLI commands to automate UI on a connected device. While it does not include destructive or data-exfiltration actions, controlling a device via adb shell input and launching intents is a powerful capability that could inadvertently interact with sensitive apps if misused, so caution is warranted.

Findings
  • •Uses adb shell input, am start, monkey, and dumpsys to control a connected Android device; these are powerful device-control commands but are used for legitimate UI automation purposes.
  • •No destructive, exfiltrating, or obfuscated commands are present.
How this analysis is made

Examples

Open URL and read page
On the Android device connected over adb, open https://news.ycombinator.com in the browser, dismiss any cookie or permission dialogs, and read the top three story titles back to me.
Search inside installed app
Launch the installed app com.example.shop on device emulator-5554, search for "running shoes", open the first result, and stop on the product page.
Install APK and clear onboarding
Install /tmp/app-debug.apk on the connected Android device, launch it, clear the onboarding screens and permission prompts, and confirm you have reached the main home screen.

name: android-cli-ui-automation-skill description: Automate UI on a connected Android device or emulator via the Android CLI. Use when asked to launch an app, tap a button, enter text, navigate a URL, or drive any on-screen flow to a goal.

Drive the device in a tight launch → observe → act → re-observe loop until the goal is reached. Prefer android layout for structured UI. Use screenshot mode whenever it is faster or more reliable.

If multiple devices are connected, get the serial with adb devices -l. Pass --device=<serial> to android ... and -s <serial> to adb ....

1. Launch

  • URL in a browser: adb -s <serial> shell am start -a android.intent.action.VIEW -d '<url>'
  • Already-installed app: adb -s <serial> shell monkey -p <pkg> -c android.intent.category.LAUNCHER 1
  • APK file: android run --apks=<path> --device=<serial> [--activity=<name>]

2. Observe with android layout

android layout --device=<serial> --pretty --output=/tmp/ui.json

Match targets by text, content-desc, or resource-id. Use the node's center as tap coordinates.

Re-observe after each action with the mode you chose. android layout --device=<serial> --diff is useful when you only need to see what changed.

3. Use screenshot mode when visual targeting is easier

Screenshot mode is often the better choice for:

  • WebView or browser page content
  • Icon-only custom views
  • Canvas, map, or game surfaces
  • Any screen where layout is noisy, incomplete, or slower to interpret than the image
android screen capture --output=/tmp/ui.png --annotate
android screen resolve --screenshot=/tmp/ui.png --string="input tap #N"

Labels are valid only for that screenshot. Capture again after every UI change.

4. Act with adb shell input

adb -s <serial> shell input tap <x> <y>
adb -s <serial> shell input text '<text-with-%s-for-spaces>'
adb -s <serial> shell input swipe <x1> <y1> <x2> <y2> <ms>
adb -s <serial> shell input keyevent <KEYCODE>

Example: adb -s <serial> shell input text 'hello%sworld'

Rules

  • Re-observe after every action. Coordinates and screenshot labels go stale immediately.
  • Clear blockers first: permission dialogs, onboarding sheets, update prompts.
  • Use the observation mode that is clearer: layout for structured UI, screenshot for visual UI.

Notes

  • Don't type URLs into the address bar. Open them with am start -a VIEW -d '<url>'.
  • If the foreground app is unclear, check it with adb -s <serial> shell dumpsys window | rg 'mCurrentFocus|mFocusedApp'.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/android-cli-ui-automation-mrx3y0mx/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/android-cli-ui-automation-mrx3y0mx' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/android-cli-ui-automation-mrx3y0mx/download' --output '.skill-downloads/android-cli-ui-automation-mrx3y0mx/SKILL.md.part' && mv '.skill-downloads/android-cli-ui-automation-mrx3y0mx/SKILL.md.part' '.skill-downloads/android-cli-ui-automation-mrx3y0mx/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/android-cli-ui-automation-mrx3y0mx/SKILL.md' && test -s '.skill-downloads/android-cli-ui-automation-mrx3y0mx/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/android-cli-ui-automation-skill' && cp -R '.skill-downloads/android-cli-ui-automation-mrx3y0mx' '.claude/skills/android-cli-ui-automation-skill'

Cursor
test -f '.skill-downloads/android-cli-ui-automation-mrx3y0mx/SKILL.md' && test -s '.skill-downloads/android-cli-ui-automation-mrx3y0mx/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/android-cli-ui-automation-skill' && cp -R '.skill-downloads/android-cli-ui-automation-mrx3y0mx' '.cursor/skills/android-cli-ui-automation-skill'

Codex
test -f '.skill-downloads/android-cli-ui-automation-mrx3y0mx/SKILL.md' && test -s '.skill-downloads/android-cli-ui-automation-mrx3y0mx/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/android-cli-ui-automation-skill' && cp -R '.skill-downloads/android-cli-ui-automation-mrx3y0mx' '.agents/skills/android-cli-ui-automation-skill'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/android-cli-ui-automation-mrx3y0mx'

openskills read 'android-cli-ui-automation-mrx3y0mx'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/android-cli-ui-automation-mrx3y0mx/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills