# How to Give Claude Code a Phone: Setting Up phone-connector-for-claude and an Android Emulator

> AI Release · @ai_releaseorg · https://ai-release.org/guides/kak-dat-claude-code-telefon-ustanovka-phone-connector-f_en.html

## TL;DR
- Time to complete: about 40 minutes
- Difficulty: Intermediate
- You need: Claude Code installed and signed in; Android SDK command-line tools with `platform-tools` and `emulator`; one Android system image; the phone-connector-for-claude sources; one free local TCP port.

## What you will get
- A booted Android emulator named `claude-phone` that `adb devices` reports as `emulator-5554	device`.
- A running phone-connector-for-claude process bound to a local port, startable with one command after a reboot.
- A confirmed round trip: Claude Code sends an action to the connector, the connector executes it over ADB on the emulator, and Claude Code prints the device's real answer.
- A screenshot file pulled from the emulator as proof the channel carries real device output.

## Quick start
```bash
export ANDROID_HOME="$HOME/Android/Sdk"; export PATH="$ANDROID_HOME/platform-tools:$ANDROID_HOME/emulator:$PATH"
avdmanager create avd -n claude-phone -k "<system-image-id>" -d pixel
emulator -avd claude-phone -no-snapshot -no-audio & adb wait-for-device
cd ~/phone-connector-for-claude && <connector-start-command> --port 8765
```
Details and verification — in the steps below.

## Requirements and setup
![Illustration: Requirements and setup](https://ai-release.org/guides/img/kak-dat-claude-code-telefon-ustanovka-phone-connector-f-en-1.jpg?v=1795812345)

- Linux, macOS, or Windows 10/11. On Windows run the ADB commands from PowerShell and use `%USERPROFILE%\AppData\Local\Android\Sdk` as the SDK path.
- Android SDK packages `platform-tools` (contains `adb` — Android Debug Bridge, the command-line channel to a device) and `emulator`.
- One system image. The exact ID has the form `system-images;android-<API-level>;<tag>;<abi>` and is listed in Android Studio's SDK Manager — copy it from there, do not guess it.
- Claude Code installed and authenticated. If you have only used the desktop build, flags and workspace handling differ from the CLI — see [Claude Code Desktop: setup, limits and how it differs from the CLI](https://ai-release.org/guides/claude-code-desktop-ustanovka.html?utm_source=tg&utm_medium=channel&utm_campaign=guide_inline&utm_content=guide_to_guide).
- phone-connector-for-claude cloned locally. Its install command, start command, default port, and configuration variable names are defined in its own README — take them from there and substitute them for the placeholders below.
- A free local TCP port. Any unused port works; examples use `8765`.
- Optional: a physical handset instead of the emulator. Enable Developer options → USB debugging, then run `adb devices`. For pairing a real phone with a Windows desktop without vendor software, see [How to Connect Android to Windows without Microsoft Phone Link: Open Source Alternatives](https://ai-release.org/guides/kak-svyazat-android-s-windows-bez-microsoft-phone-link.html?utm_source=tg&utm_medium=channel&utm_campaign=guide_inline&utm_content=guide_to_guide).

## Step 1. Install the SDK tools and boot an emulator
**What to do:** install the packages, create the virtual device, boot it without a window, and confirm ADB sees it.

```bash
sdkmanager "platform-tools" "emulator" "<system-image-id>"
avdmanager create avd -n claude-phone -k "<system-image-id>" -d pixel
emulator -avd claude-phone -no-snapshot -no-audio &
adb wait-for-device
adb devices
```

**Example:** `avdmanager` answers with something like `Auto-selecting single ABI x86_64`, and `adb devices` prints:

```
List of devices attached
emulator-5554	device
```

AVD stands for Android Virtual Device — the saved hardware profile the emulator boots from. `-no-snapshot` forces a clean boot so the device state is predictable; `-no-audio` avoids audio-driver failures on headless machines.

**Why:** the connector never talks to a phone directly — it shells out to `adb`. A device that `adb` cannot see is invisible to Claude Code regardless of how the connector is configured.

**How to check:**
```bash
adb shell getprop ro.build.version.sdk
```
It prints the API level of the running image, for example `34`. An empty answer means the device is still booting — rerun `adb wait-for-device`.

## Step 2. Install and start phone-connector-for-claude
![Illustration: Step 2. Install and start phone-connector-for-claude](https://ai-release.org/guides/img/kak-dat-claude-code-telefon-ustanovka-phone-connector-f-en-2.jpg?v=1795812349)

**What to do:** install the project's dependencies, set the two values it needs (device serial and port), and start it.

```bash
git clone <connector-repository-url> ~/phone-connector-for-claude
cd ~/phone-connector-for-claude
<install-command>
<connector-start-command> --port 8765
```

**Example:** collect these values before starting:

| Value | Where to take it | Example |
|---|---|---|
| Device serial | output of `adb devices` | `emulator-5554` |
| ADB binary | `$ANDROID_HOME/platform-tools/adb` | `/home/dev/Android/Sdk/platform-tools/adb` |
| Port | any free local port | `8765` |

Write them into the project's config file (`.env`, `config.yaml`, or CLI flags — the project decides), using the variable names from its README.

**Why:** a fixed device serial matters as soon as a second emulator or a real phone is attached. Without it the connector can pick the wrong device, and every command will look successful while hitting the wrong screen.

**How to check:**
```bash
ss -ltnp | grep 8765
# macOS: lsof -iTCP:8765 -sTCP:LISTEN
```
You should see exactly one process listening. No output means the connector exited — read its stdout.

If the project ships as an MCP server (Model Context Protocol — the standard way Claude Code loads external tools), register it once:

```bash
claude mcp add phone -- <connector-start-command> --port 8765
claude mcp list
```

## Step 3. Verify the round trip from Claude Code
![Illustration: Step 3. Verify the round trip from Claude Code](https://ai-release.org/guides/img/kak-dat-claude-code-telefon-ustanovka-phone-connector-f-en-3.jpg?v=1795812355)

**What to do:** ask Claude Code to act on the phone, then repeat the same action manually and compare results.

**Example prompt inside Claude Code:** `List the attached Android devices, take a screenshot from emulator-5554, and report the screen resolution.`

Manual reference:

```bash
adb -s emulator-5554 exec-out screencap -p > /tmp/screen.png
adb -s emulator-5554 shell wm size
ls -l /tmp/screen.png
```

`wm size` answers with a line like `Physical size: 1080x2400`, and `ls -l` shows a non-zero PNG.

**Why:** an open port only proves the process started. One executed device command proves the whole chain — Claude Code → connector → adb → emulator → back — works end to end.

**How to check:**
- [ ] `adb devices` lists `emulator-5554` as `device`
- [ ] `ss -ltnp` shows the connector port in LISTEN state
- [ ] `claude mcp list` lists the phone server (if you registered one)
- [ ] `/tmp/screen.png` is non-zero and opens as an image
- [ ] Claude Code's answer contains the same resolution `wm size` returned

## Troubleshooting
**Problem. The connector reports no phone**
- Error: `error: no devices/emulators found`
- Cause: the ADB server was started before the emulator came up, or the emulator process died after `-no-audio`/headless launch.
- Solution: restart both halves in order.
```bash
adb kill-server && adb start-server
emulator -avd claude-phone -no-snapshot-load &
adb wait-for-device && adb devices
```

**Problem. The connector cannot bind its port**
- Error: `Error: listen EADDRINUSE: address already in use :::8765`
- Cause: a previous run of the connector is still alive, or another service owns the port.
- Solution: find and stop the owner, or move to another port.
```bash
lsof -i :8765
kill <PID>
<connector-start-command> --port 8766
```

**Problem. ADB is not on PATH**
- Error: `adb: command not found` (Linux/macOS) or `'adb' is not recognized as an internal or external command` (Windows).
- Cause: `platform-tools` was installed but its directory was never added to the shell environment.
- Solution: export the two SDK paths from Step 1, then confirm the binary resolves.
```bash
which adb        # Windows: where adb
adb version
```

## Summary and next steps
You now have an emulator that ADB sees and a connector that Claude Code can call, verified by a real screenshot round trip. To run the same setup for several developers with shared subagents, continue with [Claude Code for Teams: Setting Up Subagents and a Shared AI Superagent](https://ai-release.org/guides/claude-code-dlya-komandy-kak-nastroit-subagentov-i-obsc.html?utm_source=tg&utm_medium=channel&utm_campaign=guide_inline&utm_content=guide_to_guide).

## FAQ
**Does Claude Code need an emulator, or can it drive a real phone?**
A real phone works the same way once `adb devices` lists it: enable Developer options → USB debugging, connect the cable, and put the serial from `adb devices` into the connector config instead of `emulator-5554`.

**Which Android system image should I pick?**
The one listed in Android Studio's SDK Manager for your CPU architecture. Copy its full ID (`system-images;android-<API-level>;<tag>;<abi>`) verbatim into both the `sdkmanager` and `avdmanager` commands — this guide deliberately does not fix an API level.

**Why does the connector start but Claude Code sees no phone tool?**
The MCP registration is per-project or per-user and is not created by starting the process. Run `claude mcp list`; if the phone server is missing, re-run `claude mcp add phone -- <connector-start-command> --port 8765` from the same directory and restart Claude Code.

**Can I run the emulator without a graphical session?**
Yes — `emulator -avd claude-phone -no-snapshot -no-audio` starts it headless and the screenshot command still returns a real frame. If your CI image has no display, check the emulator documentation for the headless flag recommended for your version.
