How to preview a Claude Code–built Android app

Claude Code is genuinely good at the first 90% of an Android app: the code, the build, even the tests. The last 10% is awkward for everyone — the app exists as an .apk file and nobody in the conversation can see it. This guide wires PreviewAPK into the loop so every build lands on a cloud device that Claude can drive and verify, and that you can open with a link.

Try it with a live device

PreviewAPK is in private beta. Get early access to test your own builds.

Get early access

What you need

Option A: the CLI (two minutes)

Download the CLI once, from any terminal:

curl -o previewapk https://previewapk.siteport.site/cli/previewapk.py && chmod +x previewapk

export PREVIEWAPK_API_KEY=<your key>

Then the whole loop is one command per build:

./previewapk push app/build/outputs/apk/debug/app-debug.apk --run

It prints the session's share link. Poll ./previewapk status until the device is live, then ./previewapk shot screen.jpg saves the current screen — an image Claude can open and inspect like any other file in the project.

Option B: the MCP server (native tools)

If you'd rather Claude have tools than a shell script, register the MCP server once:

curl -o previewapk_mcp.py https://previewapk.siteport.site/mcp/previewapk_mcp.py

claude mcp add previewapk --env PREVIEWAPK_API_KEY=<your key> -- python3 /path/to/previewapk_mcp.py

Claude now has previewapk_push_apk, previewapk_start, previewapk_tap, previewapk_tap_text, previewapk_type_text, previewapk_screenshot (which returns the screen as an image in the conversation), previewapk_hierarchy (the screen as an element tree — cheaper than screenshots for navigation), previewapk_handoff, and friends. The screenshot tool is the one that changes the dynamic: the result comes back inside the session, so verification is part of Claude's normal turn.

The prompt to give your agent

Paste this into your project's CLAUDE.md (or say it once in the session):

"After every successful Android build, push the APK to PreviewAPK with the CLI (or the previewapk MCP tools), start an agent-driven session, and screenshot the screens you changed. If something looks wrong, fix it and rebuild before telling me it's done. When it looks right, hand the session to me (driver: user) and give me the preview link with a one-line summary of what you verified."

That one paragraph is the difference between "the build succeeded" and "I looked at it, and it works."

Driver modes, in this workflow

Claude starts sessions agent-driven: it taps and types through the API while you, in the portal, watch it work in real time — a strange and useful sight the first time. When it's done, handoff passes the same live session to you, no reboot: now your taps count and its input is refused. If you'd rather Claude never drive, have it start sessions user-driven; then it can push builds and open sessions, but every input call it makes is rejected. Full details in the developer & agent guide.

Troubleshooting

Keep going

FAQ

Does Claude Code need Android Studio for this?

Claude Code needs a way to compile the APK (a JDK and the Android SDK command-line tools are enough). What PreviewAPK removes is the second half: no emulator images, no Android Studio GUI, no physical device needed to see and test the result.

Can Claude verify the UI itself, or does it just start the app?

It can verify. In an agent-driven session Claude can tap, type, and request screenshots — returned as images it can inspect — so it can check that a screen looks right, iterate if it doesn't, and only then hand the session to you.

What exactly gets uploaded — my code?

Only the compiled APK, the same file you'd send a tester. Your source code stays in your repo; PreviewAPK never sees it. The APK lands on your own device slot, and share links from it are view-only.

Which agents does this work with besides Claude Code?

The same three doors — CLI, REST API, MCP — work for Cursor, Codex, and any agent that can run a shell command or speak MCP. Claude Code is the worked example because its MCP and shell support make the loop especially clean.