android-use

Control Android devices via ADB. Use when user asks to tap, swipe, type, launch apps, take screenshots, or automate Android device interactions.

13 stars

Best use case

android-use is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Control Android devices via ADB. Use when user asks to tap, swipe, type, launch apps, take screenshots, or automate Android device interactions.

Teams using android-use should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

How android-use Compares

Feature / Agentandroid-useStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Control Android devices via ADB. Use when user asks to tap, swipe, type, launch apps, take screenshots, or automate Android device interactions.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Android Device Control

CLI for Android device control via ADB. Requires device connected with USB debugging enabled.

## Prerequisites

Before using this skill:

1. Android device with USB debugging enabled
2. ADB installed (`adb version` should work)
3. Device connected via USB or emulator running

## Agent Installation (Autonomous Setup)

When this skill is not installed, agents should:

1. **Run installer (recommended):**

   ```bash
   curl -fsSL https://raw.githubusercontent.com/iurysza/android-use/main/install.sh | bash
   ```

2. **Installed structure:**

   - `~/.config/opencode/skill/android-use/SKILL.md`
   - `~/.config/opencode/skill/android-use/scripts/android-use`
   - `~/.config/opencode/skill/android-use/references/`
   - `~/.config/opencode/skill/android-use/assets/`
   - `~/.config/opencode/skill/android-use/repo/`

3. **Verify installation:**

   ```bash
   ~/.config/opencode/skill/android-use/scripts/android-use check-device
   ```

## Quick Start

```bash
android-use check-device        # List connected devices
android-use get-screen          # Get UI hierarchy (compact JSON)
android-use tap 540 960         # Tap at coordinates
android-use type-text "Hello"   # Type text
android-use key HOME            # Press key
android-use screenshot ./screen.png  # Capture screen
```

## Core Agent Workflow

**STEP 1: Check device**

```bash
android-use check-device
```

- Lists all connected devices
- Note the serial number if multiple devices
- For "phone" use [PHYSICAL] device
- For "emulator" use [EMULATOR] device

**STEP 2: Get screen state**

```bash
android-use get-screen
```

- Returns compact JSON with pre-calculated tap coordinates
- Search for: `text`, `contentDesc`, `resourceId`
- Use the `center` field for coordinates (e.g., `"center": [540, 289]`)
- Cache location: `/tmp/.ai-artifacts/skills/android-use/screen.json`

**STEP 3: Execute action**

- Tap: `android-use tap <center_x> <center_y>`
- Type: `android-use tap <field_x> <field_y>` then `android-use type-text "text"`
- Swipe: `android-use swipe <x1> <y1> <x2> <y2> [duration_ms]`
- Key: `android-use key <KEY_NAME>` (HOME, BACK, ENTER, etc.)

**STEP 4: Verify and repeat**

- Run `get-screen` again to verify state change
- Handle any dialogs that appeared
- Repeat until goal achieved

## Commands

### Device & Screen

| Command        | Args              | Description                               |
| -------------- | ----------------- | ----------------------------------------- |
| `check-device` | `[serial]`        | List/verify connected devices             |
| `wake`         | `[serial]`        | Wake device + dismiss lock                |
| `get-screen`   | `[serial]`        | Dump UI accessibility tree (compact JSON) |
| `screenshot`   | `[path] [serial]` | Capture screen image                      |

### Input Actions

| Command     | Args                                | Description        |
| ----------- | ----------------------------------- | ------------------ |
| `tap`       | `<x> <y> [serial]`                  | Tap at coordinates |
| `type-text` | `<text> [serial]`                   | Type text string   |
| `swipe`     | `<x1> <y1> <x2> <y2> [ms] [serial]` | Swipe gesture      |
| `key`       | `<keycode\|name> [serial]`          | Press key          |

### App Management

| Command       | Args                 | Description                |
| ------------- | -------------------- | -------------------------- |
| `launch-app`  | `<package> [serial]` | Launch app by package name |
| `install-apk` | `<path> [serial]`    | Install APK file           |

## Global Options

| Option              | Description                        |
| ------------------- | ---------------------------------- |
| `-s, --serial <id>` | Target specific device             |
| `--json`            | Output as JSON                     |
| `--verbose`         | Verbose logging                    |
| `--timeout <ms>`    | Timeout (default: 15000)           |
| `--adb-path <path>` | Path to ADB binary                 |
| `--full`            | Full XML output (for `get-screen`) |

## Common App Package Names

Use these package names with `launch-app`:

| App Name | Package Name |
|----------|-------------|
| **Chrome** | `com.android.chrome` |
| **Settings** | `com.android.settings` |
| **Phone / Dialer** | `com.android.dialer` |
| **Messages / SMS** | `com.google.android.apps.messaging` |
| **Camera** | `com.android.camera` |
| **Photos** | `com.google.android.apps.photos` |
| **Gmail** | `com.google.android.gm` |
| **Maps** | `com.google.android.apps.maps` |
| **YouTube** | `com.google.android.youtube` |
| **Play Store** | `com.android.vending` |
| **Calendar** | `com.google.android.calendar` |
| **Clock** | `com.google.android.deskclock` |
| **Calculator** | `com.google.android.calculator` |
| **Contacts** | `com.android.contacts` |
| **Files** | `com.google.android.documentsui` |
| **WhatsApp** | `com.whatsapp` |
| **Instagram** | `com.instagram.android` |
| **Facebook** | `com.facebook.katana` |
| **Twitter / X** | `com.twitter.android` |
| **Spotify** | `com.spotify.music` |
| **Netflix** | `com.netflix.mediaclient` |
| **Telegram** | `org.telegram.messenger` |
| **Discord** | `com.discord` |
| **Slack** | `com.Slack` |
| **Zoom** | `us.zoom.videomeetings` |
| **Teams** | `com.microsoft.teams` |
| **Outlook** | `com.microsoft.office.outlook` |
| **Drive** | `com.google.android.apps.docs` |
| **Keep / Notes** | `com.google.android.keep` |
| **Reddit** | `com.reddit.frontpage` |
| **Bluesky** | `xyz.blueskyweb.app` |

## Reading Screen Data

**Compact JSON (default):**
`get-screen` outputs pre-calculated tap coordinates and filtered elements (99% smaller than XML):

```json
{
  "elements": [
    {
      "text": "Settings",
      "resourceId": "com.android.settings:id/title",
      "contentDesc": "",
      "clickable": true,
      "scrollable": false,
      "focused": false,
      "bounds": [42, 234, 1038, 345],
      "center": [540, 289]
    }
  ],
  "clickable": [...],
  "scrollable": [...],
  "withText": [...],
  "withContentDesc": [...]
}
```

**Key attributes:**

- `text` - Visible text
- `contentDesc` - Accessibility description (icons)
- `resourceId` - Element identifier
- `clickable` / `scrollable` - Interaction states
- `center` - Pre-calculated tap coordinates `[x, y]`
- `bounds` - Original bounds `[left, top, right, bottom]`

**Use pre-calculated center:**

- Already calculated: `tap 540 289` (no manual math needed)

**Full XML (when needed):**

- Use `get-screen --full` for raw XML
- Saves to `/tmp/.ai-artifacts/skills/android-use/screen.xml`

**Cache location (memory-backed):**

- `/tmp/.ai-artifacts/skills/android-use/screen.json` (compact)
- `/tmp/.ai-artifacts/skills/android-use/screen.xml` (full)

## Key Names

`HOME`, `BACK`, `MENU`, `POWER`, `ENTER`, `TAB`, `DEL`, `ESCAPE`, `VOLUME_UP`, `VOLUME_DOWN`, `DPAD_UP`, `DPAD_DOWN`, `DPAD_LEFT`, `DPAD_RIGHT`

## Multi-Device Support

When multiple devices connected:

1. Run `check-device` to see all devices with types
2. User says "phone/physical" -> use `[PHYSICAL]` device
3. User says "emulator" -> use `[EMULATOR]` device
4. Pass `-s <serial>` to ALL subsequent commands

```bash
android-use check-device
# Multiple devices connected (2):
#   [PHYSICAL] 1A051FDF6007PA - Pixel 6
#   [EMULATOR] emulator-5554 - sdk_gphone64_arm64

android-use -s 1A051FDF6007PA get-screen
android-use -s 1A051FDF6007PA tap 540 960
```

## Common Patterns

### Tap a button

```bash
android-use get-screen              # Get JSON with pre-calculated centers
# Search JSON for button, find center: [540, 289]
android-use tap 540 289             # Tap at center
```

### Enter text in field

```bash
android-use tap 540 184             # Focus field
android-use type-text "search term"
android-use key ENTER               # Submit
```

### Scroll to find content

```bash
android-use get-screen              # Check if visible
android-use swipe 540 1500 540 500  # Swipe up (scroll down)
android-use get-screen              # Check again
```

### Handle dialogs

```bash
# Look for "OK", "Allow", "Accept" buttons in XML
android-use tap <button-center>
# Or dismiss with back
android-use key BACK
```

### Open app and navigate

```bash
android-use launch-app com.android.chrome
android-use get-screen
# Find URL bar, tap it
android-use tap 540 184
android-use type-text "example.com"
android-use key ENTER
```

## Agent Examples

See the `references/` directory for:

- `AGENTS_GETTING_STARTED.md` - Setup and command guide
- `AGENT_WORKFLOWS.md` - End-to-end agent workflows
- `01-taking-a-screenshot.md` - Capture and verify screenshots
- `02-opening-an-app.md` - App launch and navigation
- `03-tapping-a-button.md` - Tap flow from screen JSON
- `04-filling-a-form.md` - Multi-step form input pattern
- `05-scrolling-to-find-content.md` - Scroll/search interaction loop
- `06-handling-dialogs.md` - Popup detection and dismissal

## JSON Output

Use `--json` for structured output:

```bash
android-use --json check-device
```

```json
{
  "success": true,
  "exitCode": 0,
  "data": { "devices": [...], "count": 1 },
  "message": "Found 1 device(s)",
  "trace": { ... }
}
```

## Error Handling

- **No device**: Check USB, verify USB debugging enabled, accept "Allow USB debugging?" prompt
- **Element not found**: Get fresh screen dump, try scrolling
- **Action didn't work**: Add minimal delay (300ms max) only if retrying, then verify coordinates, check for popups/dialogs, get fresh screen dump
- **Device offline**: Reconnect USB, run `adb kill-server && adb start-server`

## Agent Best Practices

1. **Always get-screen first** - understand current UI state
2. **No artificial delays needed** - Commands execute synchronously; UI is ready for next command immediately
3. **Check your work** - get-screen after each action to verify
4. **Use screenshots** - when JSON doesn't capture enough info
5. **Be consistent** - use same serial for all commands in session
6. **Compact JSON default** - 99% smaller, pre-calculated tap coords, cached to `/tmp/.ai-artifacts/skills/android-use/`
7. **Handle dialogs** - popups often block interactions
8. **Use center coordinates** - from JSON output, no manual calculation needed

## Compact JSON Filter Logic

The compact JSON includes elements with ANY of:

- Non-empty `text` (visible labels)
- Non-empty `contentDesc` (accessibility descriptions)
- `clickable = true` (interactive elements)
- `scrollable = true` (scrollable containers)

This filters ~336 raw nodes → ~55 useful elements (4x smaller)

## Repository

- GitHub: https://github.com/iurysza/android-use
- Issues: https://github.com/iurysza/android-use/issues
- References: See `references/` folder

Related Skills

reverse-engineering-android-malware-with-jadx

16
from plurigrid/asi

Reverse engineers malicious Android APK files using JADX decompiler to analyze Java/Kotlin source code, identify malicious functionality including data theft, C2 communication, privilege escalation, and overlay attacks. Examines manifest permissions, receivers, services, and native libraries. Activates for requests involving Android malware analysis, APK reverse engineering, mobile malware investigation, or Android threat analysis.

performing-dynamic-analysis-of-android-app

16
from plurigrid/asi

Performs runtime dynamic analysis of Android applications using Frida, Objection, and Android Debug Bridge to observe application behavior during execution, intercept function calls, modify runtime values, and identify vulnerabilities that static analysis misses. Use when testing Android apps for runtime security flaws, hooking sensitive methods, bypassing client-side protections, or analyzing obfuscated applications. Activates for requests involving Android dynamic analysis, runtime hooking, Frida Android instrumentation, or live app behavior analysis.

performing-android-app-static-analysis-with-mobsf

16
from plurigrid/asi

Performs automated static analysis of Android applications using Mobile Security Framework (MobSF) to identify hardcoded secrets, insecure permissions, vulnerable components, weak cryptography, and code-level security flaws without executing the application. Use when assessing Android APK/AAB files for security vulnerabilities before deployment, during penetration testing, or as part of CI/CD security gates. Activates for requests involving Android static analysis, MobSF scanning, APK security assessment, or mobile application code review.

analyzing-android-malware-with-apktool

16
from plurigrid/asi

Perform static analysis of Android APK malware samples using apktool for decompilation, jadx for Java source recovery, and androguard for permission analysis, manifest inspection, and suspicious API call detection.

testing-android-intents-for-vulnerabilities

16
from plurigrid/asi

Tests Android inter-process communication (IPC) through intents for vulnerabilities including intent injection, unauthorized component access, broadcast sniffing, pending intent hijacking, and content provider data leakage. Use when assessing Android app attack surface through exported components, testing intent-based data flows, or evaluating IPC security. Activates for requests involving Android intent security, IPC testing, exported component analysis, or Drozer assessment.

android-remote

14
from AbdullahMalik17/malikclaw

Remote control and automation for Android devices. Best for testing apps, monitoring notifications, and performing tasks on old phones.

mobile-android

13
from williamzujkowski/standards

Mobile-Android standards for mobile android in Frontend environments.

tech-android

11
from ravnhq/ai-toolkit

Android and Kotlin development patterns — Compose, architecture, coroutines, Room, navigation, Hilt. Use when building Android apps, writing Jetpack Compose UI, or reviewing Android-specific code.

ios-to-android

10
from michaelboeding/skills

Use iOS/Swift code as the source of truth and implement the equivalent feature in Android/Kotlin. Understands the feature behavior, data structures, and logic from iOS, then creates idiomatic Android code that matches the target codebase's existing patterns. Use when porting features from iOS to Android or ensuring platform consistency.

android-to-ios

10
from michaelboeding/skills

Use Android/Kotlin code as the source of truth and implement the equivalent feature in iOS/Swift. Understands the feature behavior, data structures, and logic from Android, then creates idiomatic iOS code that matches the target codebase's existing patterns. Use when porting features from Android to iOS or ensuring platform consistency.

testing-android-intents-for-vulnerabilities

9
from killvxk/cybersecurity-skills-zh

测试 Android 进程间通信(IPC)中 Intent 的安全漏洞,包括 Intent 注入、未授权组件访问、 广播嗅探、PendingIntent 劫持和 ContentProvider 数据泄露。适用于评估 Android 应用导出组件 攻击面、测试 Intent 数据流或评估 IPC 安全性的场景。适合涉及 Android Intent 安全、IPC 测试、 导出组件分析或 Drozer 评估的相关请求。

reverse-engineering-android-malware-with-jadx

9
from killvxk/cybersecurity-skills-zh

使用 JADX 反编译器对恶意 Android APK 文件进行逆向工程,分析 Java/Kotlin 源代码,识别包括数据窃取、C2 通信、权限提升和覆盖攻击在内的恶意功能。检查 Manifest 权限、Receiver、Service 及原生库。适用于 Android 恶意软件分析、APK 逆向工程、移动端恶意软件调查或 Android 威胁分析等请求。