# Set up an Android emulator

Install the Android tools, start an emulator from Android Studio, let Silan add its helper, and give the first task.

Silan controls Android through the Android platform tools and a small helper app it installs on the device. Android emulators are supported. Android phones are in testing: the steps are in the app and the proof on a real phone is still owed.

What is proved: Silan's Android test suites run on an emulator and cover taps, typing, swipes and the element list. A first agent task on an emulator through the chat has no recorded report yet, so the last step of this guide is in testing.

Time: about 20 minutes, less if Android Studio is already on the Mac.

You need:

- Android Studio, with one virtual device made in its Device Manager.
- Homebrew, for the platform tools. The tools that come with Android Studio work too.
- Silan, with **Android phone or tablet** or **Simulators and emulators** ticked under **What Silan controls** in setup.

## Steps

1. Install the platform tools. Silan never ships `adb`. It looks in Android Studio's SDK first, then Homebrew, then your PATH.

   ```sh
   brew install android-platform-tools
   ```

   Silan shows the same line, with a **Copy** button, in **Settings › Devices & Drivers** while the tools are missing.

2. Open Android Studio, go to **Device Manager** and start a virtual device. The emulator window opens on the Mac.
3. Switch to Silan. The emulator shows in the sidebar through `adb`. If the adb server was not running, Silan starts it, once every 30 seconds at most. **Settings › Devices & Drivers** reads **Silan is starting the Android tools.** for a moment.
4. Watch the emulator's row. Silan installs its helper app on the device. Until the helper runs, Silan has adb-only control. Once it runs, the device lists tap, type, swipe and the other touch actions. Click the row to see the live picture.
5. Check the tools from the command line if you like:

   ```sh
   SILAN=/Applications/Silan.app/Contents/Helpers/silan
   $SILAN devices --platform android
   $SILAN device <device id>
   ```

   The device's page lists its capabilities and health, including the `android.adb.server` check.

6. Give the first task. Click **New chat**, pick the emulator from the device list under the message box, type `Open Settings and tell me the Android version.` and click **Send**. The agent opens Settings, scrolls to **About** and reads the version into the answer card. This step is in testing: the chat path on an emulator has no recorded proof yet.

Emulators give the element list, notifications, clipboard, location and app install, so flows from the [flow guide](/guides/write-and-run-a-flow/) run on them too. Set the role's `platform` to `android` and use Android package names in `launch`. Test pushes do not work on emulators: Silan refuses `send_test_push` there.

## A real Android phone

The app has one checklist, **Get your Android phone ready**, under the phone's **Set up** button: install the Android tools, turn on USB debugging on the phone, plug it in and tap **Allow** on the phone, and Silan adds its helper app. Each step ticks by itself. Treat this as in testing until a proof on a real phone lands.

## If something goes wrong

- **The emulator does not show in Silan.** Run `adb devices` in Terminal. If the emulator is not listed there, restart it from Android Studio. If `adb` is not found, finish step 1.
- **Taps are not listed for the device.** The helper app has not finished installing. Give it a moment and open the device's **Info** tab. Its health names the step that is missing.
- **The adb server will not start.** Something else holds its port. Quit other Android tools, then open **Settings › Devices & Drivers** again so Silan can start it.
- **Silan reads Checking for Xcode.** That line is about iPhone simulators only. An Android emulator needs no Xcode.

:::note[Proof]
Android emulator control was proved by Silan workers through the engine's Android test suites on an Android emulator (use-case facts, 8f, `Tools/device-check.sh`). The Android tools detection is proved by `AndroidToolsTests` with a stand-in adb. Not yet proved: a chat task on an emulator, and any step on a real Android phone.
:::