You can run OpenCode on Android, but not the way most install guides imply.
There is no native Android app, and unlike Claude Code or Gemini CLI, a
plain npm i -g opencode-ai inside Termux does not work reliably:
the launcher misdetects the Termux environment and hands Android-arm64 a Linux-x64
binary. So "OpenCode on Android" means one of three real paths: a cloud Ubuntu
container with OpenCode pre-installed (Cosyra on Google Play, where you just type opencode, 1 hour free, no credit card),
a Termux proot-distro chroot on-device, or SSH from Termux into your
own always-on box. This guide walks each one with the honest trade-offs.
This is the Android-specific companion to our
OpenCode on your phone walkthrough
(which covers iPhone and Android generically), with a tablet sibling in
OpenCode on iPad. What changes
on Android is that Termux is a genuine on-device option, unlike on iOS, but
OpenCode is the one agent of the four where the Termux story is still
broken, which is the part most posts get wrong. The siblings to this guide
are
Claude Code on Android
and Gemini CLI on Android,
and all three feed into our
Coding on Android pillar, which maps
out everything the OS can run as a dev environment. For the broader picture across
all four mobile AI agents, see
AI coding agents on mobile. One agent worth flagging here: Kilo CLI is built on OpenCode, so it
inherits the same Termux misdetection we describe below — we have not tested
@kilocode/cli in Termux ourselves, and the clean path is the same
cloud container or proot-distro chroot. See
Kilo CLI on your phone.
Quick decision. Jump to the part that matches you:
- You want OpenCode running in minutes with nothing to babysit.
A cloud container runs the real binary and you type
opencodefrom the Android app. Cosyra setup ↓ - You want free, local, and on-device. Termux plus
proot-distroruns OpenCode in a chroot. Know the setup cost first. Termux reality ↓ - You already keep a box awake. SSH into it from Termux and run OpenCode there. SSH path ↓
Why does plain Termux break OpenCode on Android?
Plain Termux breaks OpenCode because the launcher picks the wrong binary.
OpenCode is distributed as prebuilt binaries via npm
optionalDependencies, one per platform and arch. An
opencode-android-arm64 binary was added after the old postinstall
failure (issue #12515) was fixed, so installs no longer hard-fail. But the launcher
still misdetects Termux as plain Linux and tries to run the Linux-x64 build on
an Android-arm64 device, which fails with an "incompatible binary" error. That
is
anomalyco/opencode issue #21043, opened 2026-04-04 and still open as of 2026-06-27.
The fix that would have helped, PR #21106, "allow opencode CLI to run in Termux (remove hard exit)", was closed without merging. And the native-Termux feature request (#22805) was closed without a maintainer commitment. That request is worth reading, because the person who filed it points out the thing we keep running into: Claude Code and Gemini CLI both run on Termux, and OpenCode is the holdout that needs a workaround. OpenCode the project is great: about 179,589 GitHub stars as of 2026-06-27, latest release v1.17.11 on 2026-06-25, MIT-licensed, multi-provider. The Termux launcher path is just the rough edge.
Here is an opinion the on-device purists will push back on: for OpenCode
specifically, fighting the Termux misdetection on a phone is not worth it
when the chroot or a cloud container both run the real binary cleanly. We
spent an evening on the couch getting plain Termux to load the right arch
binary and gave up; the
proot-distro route worked, and the cloud container worked with no
setup at all. "On-device or nothing" is a principle, not a workflow.
What are the three real ways to run OpenCode on Android?
There are three real ways to run OpenCode from an Android phone as of
2026-06-27: Cosyra (cloud container with OpenCode pre-installed), Termux
with
proot-distro (an on-device Debian/Ubuntu chroot), and SSH from Termux
into a box you own. We walk each below.
1. Cosyra (cloud container, native Android app)
This is what we build. The Cosyra Android app opens a persistent Ubuntu
24.04 x86_64 container reached from any Pixel, Galaxy, OnePlus, Nothing, or
foldable. OpenCode is pre-installed alongside Claude Code, Codex CLI, and
Gemini CLI on Node 20+. Because the container is glibc x86_64, the
opencode Linux-x64 binary is the correct one, so the Termux misdetection
in #21043 and the older arm64 postinstall failure simply do not happen. You get
30 GB of persistent storage, session hibernation that resumes exactly where you
left off, and the same container is reachable from iPhone, iPad, and a browser.
BYOK applies: you connect Anthropic, OpenAI, or Google once and your provider
bills you directly. We do not proxy or meter your model calls.
- Works when: you want the real OpenCode binary with zero setup, full x86_64 Ubuntu compatibility, and the same environment across every device you pick up.
- Breaks when: you have no internet. The container lives in the cloud, so there is no offline mode. That is a genuine trade-off versus a local Termux install.
- Cost: Sign up — 1 hour free, no credit card. Extend with a 10-hour, 7-day trial when you want more. After that, $29.99/month or $300/year. See pricing.
2. Termux + proot-distro (on-device, free)
Termux is an open-source (GPLv3) Android
terminal emulator with a real package manager. Because plain Termux misdetects
the OpenCode arch (issue #21043), the dependable on-device path is
proot-distro: install a Debian or Ubuntu chroot inside Termux,
which is a real glibc Linux userland, then install Node 20+ and
npm i -g opencode-ai inside it. If you want the full rundown of the
chroot path versus UserLAnd versus a cloud x86_64 container, see
Linux container on Android.
- Works when: you are on Android, you want a fully local setup
with no cloud bill, and you accept the
proot-distrooverhead. - Breaks when: the Android 12+ phantom process killer terminates
a long session with
signal 9(the same issue we document in the Claude Code on Android guide), or a new OpenCode release changes the chroot path. The misdetection bug is the headline; PR #21106 that would have fixed it was closed without merging, so it never landed. - Cost: free OpenCode binary, free Termux, free proot-distro. The cost is your time when the install path breaks between releases.
3. SSH from Termux into your own box
The classic remote route. Install OpenCode on an always-on Linux box or a
VPS (Hetzner, Scaleway, DigitalOcean) with
npm i -g opencode-ai, then ssh in from Termux inside
a tmux session and run opencode. The agent runs on
the host; the phone is just the terminal. You can also drive
opencode serve over the connection if you prefer the HTTP API to
the TUI.
- Works when: you already have a box you keep awake and you want OpenCode to run on hardware that is yours.
- Breaks when: the host sleeps, or you do not want to be a sysadmin. Patching, firewall rules, and backups are not optional on a box that holds your source and your provider keys.
- Cost: free OpenCode, plus a VPS at roughly $5 to $40/month if you do not already own a box.
How do you set up OpenCode on Android with Cosyra?
You set up OpenCode on Android in about three minutes: install Cosyra from
Google Play, confirm opencode is on the PATH in the Ubuntu container,
connect a provider, clone a repo, and type
opencode. The steps below are exactly what we run on a fresh
Pixel.
Step 1: Install Cosyra from Google Play
Open the Google Play Store and install Cosyra. The Android app runs on Pixel, Samsung Galaxy S and Z foldables, OnePlus, Nothing, and any device on Android 9 or later. Sign in with Google, Apple, or email and the app provisions a fresh Ubuntu 24.04 container with OpenCode, Claude Code, Codex CLI, and Gemini CLI already installed.
Step 2: Confirm OpenCode is installed
No install step, no chroot, no npm. OpenCode is baked into the image. Verify in one command, and note the arch, which is exactly why the Termux misdetection cannot bite here.
$ opencode --version
1.17.11
$ which opencode
/usr/local/bin/opencode
$ uname -m
x86_64
Step 3: Connect a provider
Run opencode auth and pick the provider you want: Anthropic, OpenAI,
Google, and local backends are all in the list. The flow opens a URL; sign in
on your phone browser and paste the verification code back into the terminal.
Keys persist with the container's home volume, so you do this once per provider
per container.
$ opencode auth
Select provider:
> anthropic
openai
local
Open https://opencode.ai/auth/... on your phone
Code: ****-****
Connected: anthropic
Step 4: Clone a repo and run opencode
$ git clone https://github.com/your-org/your-project.git
Cloning into 'your-project'...
$ cd your-project
$ opencode
opencode 1.17.11
workspace: /home/cosyra/your-project
agent: build (default, edit access)
OpenCode reads the repo, proposes diffs, and waits for your approval before
writing. The default build agent has edit access; the
plan agent (opencode --agent plan) is read-only if you
want to think before touching code. When the screen locks the container
keeps running; reopen the app and the session is exactly where you left it,
which is the whole point of coding from a phone on the train. The phone
keyboard is fine for the natural-language turns, since you are writing one
sentence of intent at a time, not 40-line functions.
Try it free. 1 hour on signup, no credit card. Extend with a 10-hour, 7-day trial when you want more. Google Play / App Store / Pricing details
How do the Android options compare?
The three paths line up cleanly against what matters for running an agent from a phone: whether the real binary runs, whether you fight the Termux misdetection, whether it needs another machine, and whether it works offline. The table covers the state as of 2026-06-27.
| Feature | Cosyra (Android app) | Termux + proot-distro | SSH to your box |
|---|---|---|---|
| Runs the real OpenCode binary | Yes (pre-installed) | Yes (inside chroot) | Yes (on host) |
| Hits Termux misdetection (#21043) | No (x86_64 Ubuntu) | No (chroot is real Linux) | No |
| Needs another machine | No | No | Yes (a host) |
| Works offline | No | Yes | No |
| Phantom-killer risk | None | Yes (mitigated) | None |
| Setup time (cold) | ~3 min | 30–60 min | 30–60 min |
| Cost (not counting tokens) | 1h free, then $29.99/mo | Free | VPS ~$5–40/mo |
Choose Cosyra if you want the real binary with nothing to babysit and the same container across Android, iPhone, iPad, and web. Choose Termux + proot-distro if free and offline matter more than setup time and you accept the phantom-killer risk. Choose the SSH path if you already keep a box awake. For tmux and TUI ergonomics once you are in a shell, see TUI apps on phone, part of the broader mobile coding terminal pillar. If you are weighing the whole on-device Termux model against a cloud container, our Cosyra vs Termux comparison has the full trade-off list.
Frequently asked questions
Can you run OpenCode natively on Android in Termux?
Not reliably. An opencode-android-arm64 binary exists, but the
launcher still misdetects Termux as plain Linux and tries to run the Linux-x64
binary on Android-arm64, leading to "incompatible binary" failures. That is
issue #21043 (opened 2026-04-04, still open as of 2026-06-27), and PR #21106,
which would have removed the hard exit, was closed without merging. The working
on-device path is proot-distro: a Debian or Ubuntu chroot inside Termux, which
is real Linux.
Why do Claude Code and Gemini CLI work on Termux but OpenCode doesn't?
Because OpenCode ships per-arch prebuilt binaries via npm
optionalDependencies and its launcher picks the wrong one inside
Termux. The native-Termux feature request (#22805) was opened 2026-04-16 explicitly
noting that Claude Code and Gemini CLI both run on Termux while OpenCode needs
the proot-distro workaround; it was closed without a maintainer commitment to
land native support.
[source: GitHub, anomalyco/opencode issue #22805 — "[FEATURE]: Termux native support"]
What is the fastest way to get OpenCode on an Android phone?
Install Cosyra from Google Play, sign in, and type opencode.
OpenCode is pre-installed in an Ubuntu 24.04 x86_64 container, so there is
no npm install, no proot chroot, and no arch misdetection. Signup gives
you 1 hour of free compute with no credit card.
[source: Google Play, Cosyra listing]
Does OpenCode have an official Android app?
No. The anomalyco/opencode README lists install paths for macOS, Linux (x64 and arm64), and Windows only — there is no native Android or iOS app. On Android you run it inside a Linux environment you reach from the phone: a cloud container, a proot-distro chroot, or an SSH session to your own box.
[source: GitHub, anomalyco/opencode README — supported platforms]
Will proot-distro OpenCode survive when I switch apps on Android?
Not guaranteed. Android 12 and later includes a phantom process killer that can send SIGKILL (signal 9) to background processes Termux spawns, which can end a long OpenCode run when you leave the app. You can mitigate it with device settings or adb, but the failure mode is real. A cloud container sidesteps it because the agent runs server-side, not in a process Android manages.
[source: GitHub, termux/termux-app issue #2366 — Android 12 phantom process killing]
Is OpenCode free, and what do I pay for on Android?
OpenCode itself is free and MIT-licensed; you pay your model provider directly (BYOK). On Termux + proot the software is free and your only cost is provider tokens. On Cosyra you pay for the cloud container after the free hour and trial, plus your provider tokens — we do not proxy or meter your model calls.
tl;dr
Three real ways to run OpenCode from an Android phone as of 2026-06-27.
Cosyra (native Android app, OpenCode pre-installed in a persistent Ubuntu
24.04 x86_64 container, no arch misdetection, nothing to babysit). Termux
+
proot-distro (free, on-device, because plain Termux misdetects
the arch per issue #21043 and PR #21106 was closed without merging). SSH from
Termux into your own always-on box. OpenCode is the one agent of the four where
plain Termux still breaks — Claude Code and Gemini CLI do not.
Google Play / App Store. Sign up — 1 hour free, no credit card. Extend with a 10-hour, 7-day trial when you want more.
Run OpenCode on your Android phone in three minutes.
Install Cosyra, connect a provider, type opencode.