# Android Emulator Automation: Emulators, Cloud and Phone

> Android emulator automation in Macro Automation Studio: the emulators it discovers, the adb port rules, adding a device by port, cloud devices and your phone.

Source: https://automationmacro.com/docs/devices (Devices, updated 2026-09-04)

Android emulator automation in Macro Automation Studio (MAS) starts with a device: an Android emulator on this computer, a cloud device in MAS's cloud, or, as an advanced path, your own phone. This page explains how MAS finds emulators, how you add one, and where the other two kinds fit.

## Before you start

- MAS is installed and you are signed in with an active trial or plan. See [Install MAS](/docs/install). MAS is a free download for the trial; get it from the [download page](/download).
- For an emulator: the emulator is running and ADB is switched on in its settings. The [BlueStacks](/docs/bluestacks-setup-guide), [LDPlayer](/docs/ldplayer-setup-guide), [MuMu Player](/docs/mumu-setup-guide) and [MEmu](/docs/memu-setup-guide) guides show where.
- For a cloud device: a plan with the cloud device add-on. See [Cloud devices](/docs/cloud-devices).

## How MAS finds the emulator adb port

MAS does not run `adb devices` to find emulators. It scans the running processes for known emulator names, reads the TCP ports each one is listening on, and keeps a port only when it sits inside that emulator's known range. Only ports bound to `127.0.0.1`, `0.0.0.0` or all interfaces count. The result fills the **Port** list in the **Add New Device** dialog, one entry per port with the emulator name next to it.

| Emulator | Process names MAS looks for | Ports MAS accepts |
|---|---|---|
| BlueStacks | `HD-Player`, `BlueStacks` | 5555 to 8500 |
| LDPlayer | `LdVBoxHeadless`, `Ld9BoxHeadless`, `dnplayer`, `LDPlayer`, `VBoxNetNAT` | Odd ports from 5555 to 5599 |
| Nox | `NoxVMHandle` | 62001 to 63000 |
| MEmu | `MEmuHeadless`, `MEmuHyper` | 21503 and every port ending in 3 above it, below 30000 |
| MuMu Player | `NemuHeadless`, `MuMu` | Odd ports from 5555 to 5599, port 7555, 16384 to 16576, or 26624 to 27264 |

Each emulator instance listens on its own port, so two BlueStacks windows show up as two entries. If your emulator is not in the table, or it listens outside its range, you can still type the port by hand.

> [!TIP]
> MAS scans processes, so keep the emulator window open while you add it. A stopped instance has no port to find.

## Add an Android emulator as an automation device

1. In MAS, open **Device Groups** and click **Create New Group**.
2. Enter a **Name** (3 to 255 characters), keep the type **Local**, and click **Create Group**.
3. Open the group and click **Add Device**.
4. Enter a **Device Name** of up to 50 characters.
5. Pick the port under **Port**. Click **Refresh** to scan again. If the port is missing, choose **Custom Port** and type it (1024 to 65535).
6. Optionally pick a **Startup Macro**.
7. Click **Add Device**.

The device card shows its port, its macro and its state: Stopped, Connecting, Starting, Running, Stopping or Error. **Start** connects to the emulator with `adb connect 127.0.0.1:<port>` and launches the macro; **Stop** ends the run. A port can belong to one device only; adding it twice fails with "Port is already in use". To change the port later, click **Edit Device**.

Several devices in one group can hold different macros, arguments and settings profiles, and **Start All** runs them one after another. See [Device groups](/docs/device-groups).

## Cloud devices

A cloud device is an Android device MAS runs for you. You create it on the **Cloud Devices** page with **Create**, choosing the Android version, a display preset and a DPI that stay fixed for the life of the device. **Start** boots it, **View** opens the live screen streamed over WebRTC, and **Run** launches a macro that keeps going after you close the app. Stopped devices keep their data; an account can hold up to 20 cloud devices per account. Everything else, including APK installs and quotas, is on the [Cloud devices](/docs/cloud-devices) page.

## Your own phone

> [!WARNING]
> Driving a phone is not a tested feature of the app. The steps below follow from how MAS connects to devices, but the MAS team has not verified them on every phone. If they fail for you, ask in [Discord](https://discord.gg/macroautomationstudio).

MAS adds every local device by port and always dials `127.0.0.1`. There is no USB pairing screen and no wireless pairing screen. A phone therefore works only when its adb daemon can be reached on a TCP port of this computer. Over USB you get there with an adb port forward.

1. On the phone, enable **Developer options** and **USB debugging**, then plug the phone in.
2. On the computer, run `adb devices` and accept the authorization prompt on the phone. The phone's serial must show as `device`.
3. Tell the phone's adb daemon to also listen on TCP: `adb tcpip 5555`.
4. Forward a local port to it: `adb forward tcp:5580 tcp:5555`. Pick any free local port; 5580 is only an example.
5. Check it: `adb connect 127.0.0.1:5580` should report "connected".
6. In MAS, add a device with **Custom Port** set to `5580`.

Keep the phone plugged in and its screen on. Screen size and DPI come from the phone, so templates cropped on an emulator will not match; crop them from the phone in Asset Lab.

> [!NOTE]
> MAS starts its own adb server when it connects. If a different adb build is first on your PATH, the servers replace each other and the forward is lost. Start MAS first, then set up the forward with the same adb build MAS uses, or run `adb kill-server` and repeat step 4.

Wireless debugging works the same way once the phone is paired and connected with `adb connect <phone-ip>:<port>`: forward a local port to the phone's adb port and add that local port in MAS.

## Control it from Python

The SDK does not care which kind of device is underneath. `mas.get_device_info()` returns the name and screen size, `mas.get_screen_size()` the size alone, and every tap, swipe and screenshot goes through the same calls. Scripts are launched by MAS with the device already bound, so there is nothing to connect in code. Start with the [SDK overview](/docs/sdk).

## Troubleshooting

### The Port list is empty

The emulator is not running, ADB is off in its settings, or it is not one of the emulators MAS scans for. Click **Refresh** after the emulator finishes booting. If it is still empty, use **Custom Port** with the port shown in the emulator's own settings. See [ADB troubleshooting](/docs/adb-troubleshooting).

### Port is already in use

Another device in one of your groups already owns that port. Each port can be added once. Remove the old entry or pick the other instance's port.

### The device stays on Connecting or ends in Error

MAS could not complete `adb connect`, or the emulator refused the first command. Check the port, confirm ADB is on, and follow [ADB troubleshooting](/docs/adb-troubleshooting).
