DEV Community

Cover image for How I run Android emulators for free in GitHub Codespaces
Arnab Mondal
Arnab Mondal

Posted on

How I run Android emulators for free in GitHub Codespaces

If you've ever run the Android emulator on a laptop with 8 GB of RAM, you know how it goes. The fans spin up, Chrome gets slow, and the emulator takes a minute to answer a tap. The usual fix is a cloud device farm, but those charge by the minute.

There's a third option that I don't see people talk about much.

Every GitHub account gets free Codespaces compute each month: 120 core-hours on the Free plan and 180 on Pro. A codespace is a Linux VM, and it exposes KVM. KVM is what the Android emulator needs to run at full speed instead of crawling along in software mode.

So I built Emuly. It boots an Android emulator inside your own codespace and streams the screen to your browser. Here's a short demo:

The code is MIT licensed and on GitHub: codewarnab/emuly.

Emuly landing page

What "free" means here

I want to be upfront about this, because "free" usually has a catch.

Emuly doesn't host your phone. The phone runs in a codespace on your GitHub account, so it uses the Codespaces hours you already get. Emuly uses a 4-core machine, which works out to:

GitHub plan Codespaces compute Phone time per month
Free 120 core-hours about 30 hours
Pro 180 core-hours about 45 hours

There's no card to enter. If you use up the hours, GitHub stops the codespace until the next month. Emuly never bills you.

How it works

How Emuly works: your browser or agent talks to emuly.xyz, which runs the phone in your codespace

  1. You sign in with GitHub. Emuly asks for the codespace scope and nothing else, so it can't read your repos.
  2. It creates a codespace on your account, in the region closest to you.
  3. A boot script installs the Android SDK and starts an Android 16 emulator with KVM.
  4. A small Node server inside the codespace streams the screen with scrcpy and sends your taps back.

Because the phone lives in your codespace, its data stays in your GitHub account.

The first boot takes a few minutes, because the codespace has to download the SDK and the system image. After that, starting a stopped phone is much faster.

Stopping doesn't lose anything

Codespaces bill while they run, so an idle phone stops on its own. Stopping keeps the disk, which means your installed apps and logged-in accounts are still there next time. The only thing that erases a phone is deleting it.

Three ways to use it

  • In the browser. Open the phone and click on the screen like it's a real device.
  • With your own tools. Connect adb and scrcpy to it, the same way you would with a local emulator.
  • Through a coding agent. This is the part I built it for.

Letting an agent test on a real phone

Coding agents are good at writing Android code, but they usually can't run it. They guess at what the screen looks like.

Emuly has an HTTP API and a CLI called emuly. You paste one prompt into your agent, and it installs a skill that tells it how to use them. From there, the agent can start a phone, install your APK, tap and type, take screenshots, and check the result. When it's done, it stops the phone.

You approve the GitHub sign-in once. The agent does the rest. It works with Claude Code, Codex, Cursor, Copilot, Gemini CLI, OpenCode, Windsurf and Cline.

You can self-host it

If you'd rather not use emuly.xyz, the whole app runs in one Docker container on your own machine, with your own GitHub account. The self-host guide has the steps.

Limits worth knowing

  • Your Codespaces hours are shared with any other codespaces you run.
  • It's an emulator, not a physical device. Things like real camera hardware and some Play Integrity checks won't behave like a real phone.
  • Please use one GitHub account per person. Emuly doesn't resell GitHub access, and it shouldn't be used to get around GitHub's limits.

Try it

You can start a phone at emuly.xyz, or read the code on GitHub. If it's useful to you, a star helps other people find it.

I'd like to hear what you'd use it for, and what breaks. Leave a comment and I'll reply.

Top comments (1)

Collapse
 
userxnom profile image
Abdullah Naseer •

The honesty about what "free" means is what sold me on this — 120 core-hours translating to about 30 hours a month on the Free plan, with the codespace stopping instead of charging, is a much clearer deal than a device farm charging by the minute. Running Android 16 with KVM inside the codespace and streaming it with scrcpy makes sense for a low-RAM laptop too. How is the interaction latency in practice when you are tapping through the browser, and does the first boot stay close to a few minutes once the SDK and system image are cached on the codespace disk?