DEV Community

Cover image for I Turned My Android Phone Into an AI Coding Machine
Zecel Manatad
Zecel Manatad

Posted on • Edited on

I Turned My Android Phone Into an AI Coding Machine

What if your Android phone could run a full AI coding environment?
In this guide, I’ll show you how I built a portable developer workstation using:

  • Claude Code
  • Ollama
  • OpenClaw
  • Termux
  • Ubuntu

By the end, you’ll be able to run local AI models, use coding agents directly from your phone, and turn Android into a surprisingly capable AI development machine.

What You'll Learn

  • Install Ubuntu inside Termux
  • Run Claude Code on Android
  • Configure Ollama locally
  • Fix common provider timeout issues
  • Optimize performance on low-RAM devices
  • Use OpenClaw with local models
  • Build a portable AI coding setup

This guide documents a real setup process of turning an Android phone into a portable AI development environment using Termux, Ubuntu (proot), Node.js, Ollama, and OpenClaw.

The goal: run modern AI coding tools on a mobile device without root.

Claude Code

Openclaw


🧱 1. Base Setup: Termux + Ubuntu

We start by installing Termux and setting up a Linux environment.

Install Termux packages:

pkg update && pkg upgrade -y
pkg install proot-distro git curl wget -y

Install Ubuntu:

proot-distro install ubuntu
proot-distro login ubuntu

Now we have a full Linux environment running on Android.


⚙️ 2. Installing Node.js (Critical Step)

Many modern AI tools require Node.js 22+.

Initial issue encountered:

«Node.js version mismatch (required 22.12+, installed 20.x)»

Fix:

Install Node.js using NVM (recommended for Android):

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
source ~/.bashrc

nvm install 22
nvm use 22
nvm alias default 22

Verify:

node -v
npm -v


🤖 3. Installing Ollama (Local AI Models)

Ollama allows running local LLMs directly on the device.

Install:

curl -fsSL https://ollama.com/install.sh | sh

Start server:

ollama serve

Run a model:

ollama run qwen2.5-coder:3b

For mobile devices, lightweight models are recommended:

  • qwen2.5-coder:3b
  • phi4-mini
  • gemma3:4b

🧠 4. Installing Claude Code

Claude Code is an AI coding CLI tool.

Install:

npm install -g @anthropic-ai/claude-code

Issue encountered:

  • “native binary not installed”
  • caused by Android/proot incompatibility

Fix:

Run inside Ubuntu environment only, not raw Termux.


⚠️ 5. Fixing npm Installation Errors

A major issue appeared:

ENOENT rename /root/.npm/_cacache/tmp
Invalid response body from registry

Fix:

rm -rf ~/.npm
npm cache clean --force
npm config set cache /tmp/npm-cache
mkdir -p /tmp/npm-cache

Then retry installation.


🔧 6. Installing OpenClaw (AI Agent)

OpenClaw is an AI agent system that can automate coding tasks.

Install:

npm install -g openclaw

Issue encountered:

  • Node version requirement mismatch (Node 22.12 required)

Fix:

Upgrade Node.js to version 22 using NVM.


⚙️ 7. Configuring OpenClaw

Create config file:

nano ~/.openclaw/config.json

Example configuration using Ollama:

{
"agent": {
"model": "ollama/qwen2.5-coder:3b"
},
"providers": {
"ollama": {
"base_url": "http://127.0.0.1:11434"
}
},
"features": {
"allow_shell": true,
"allow_file_edit": true
}
}


🚀 8. Running the Full Stack

Start Ollama:

ollama serve

Start OpenClaw:

openclaw chat

Now the system can:

  • analyze code
  • run shell commands
  • use local AI models
  • automate development tasks

🧩 9. Key Issues Encountered

  1. Node.js version mismatch

Fixed using NVM (Node 22)

  1. npm cache corruption

Fixed by clearing ~/.npm and using /tmp cache

  1. Android proot filesystem issues

Fixed by avoiding Termux-native installs and using Ubuntu environment

  1. Ollama connectivity issues

Fixed using 127.0.0.1 instead of localhost


🧠 Final Architecture

Android (Termux)

Ubuntu (proot)

Node.js 22 + NVM

Ollama (local AI)

OpenClaw (AI agent)

Claude API (optional cloud intelligence)


🔥 Conclusion

Android can be transformed into a full AI development workstation using Termux and Ubuntu without root.

While some tools (like OpenClaw and Claude Code) require workarounds due to Linux/Android differences, a hybrid setup of local + cloud AI makes the system powerful and practical.

This setup is ideal for:

  • AI coding on the go
  • learning Linux
  • building automation agents
  • experimenting with LLMs locally

Why Run AI Coding Tools on Android?

Running AI tools locally on Android means:

  • Portable development anywhere
  • Lower cloud costs
  • Offline experimentation
  • Privacy-friendly workflows
  • Learning Linux and AI tooling on mobile

If you want to improve this setup further, the next step is integrating VS Code (code-server) and connecting remote GPU servers for heavy models.

Final Thoughts

It’s wild how capable Android devices have become for local AI workflows.

This setup won’t fully replace a desktop workstation yet, but it’s incredibly useful for:

  • quick coding sessions
  • AI experimentation
  • learning Linux
  • running local agents anywhere

If you improve this setup or discover optimizations, drop them in the comments.

Top comments (1)

Collapse
 
tanzeel_ahmedsiddiqui_a4 profile image
Tanzeel Ahmed Siddiqui

I've done something similar with a Pixel 7 and Termux, and the part people consistently underestimate is the network side of things. Once you're running inference locally on the device and trying to hit external APIs or route traffic through Claude's endpoints or PaioClaw, you start running into carrier-level throttling and geo-restrictions that just weren't a problem on a normal dev machine.

What actually helped me was handling VPN at the Android layer itself, not inside the Termux environment, so the tunnel sits underneath everything and the Ubuntu proot doesn't have to care about it. Keeps latency manageable and stops the weird connection drops mid-session that were driving me crazy with Ollama's API calls.

The other thing I'd flag is RAM pressure. On most mid-range Android devices you're fighting the OS constantly, especially once you've got proot Ubuntu running alongside whatever model you're serving through PaioClaw or Ollama. Killing background apps aggressively and pinning Termux in the notification tray made a real difference for me.