Back to Home

OpenClaw on Android: Termux guide

Instructions for deploying OpenClaw gateway on Android using Termux and proot-Ubuntu. Describes Node.js installation, Bionic error bypass, security setup, and messenger integration. Suitable for repurposing old smartphones into AI servers.

OpenClaw AI server on smartphone: full guide
Advertisement 728x90

Deploying OpenClaw Gateway on Android via Termux and proot

Developers can repurpose an unused Android smartphone into a gateway for OpenClaw, an open-source AI assistant. This guide has been tested on a Xiaomi 11T with a Dimensity 1200 processor, 8GB RAM, and HyperOS 1.0.14.0. The approach uses Termux with a proot-Ubuntu environment to run Node.js 22 LTS and OpenClaw, bypassing Android's limitations for hosting a gateway.

Requirements: Android 10+, 4+ GB RAM, stable Wi-Fi, an API key from OpenRouter or Gemini. Storage: ~4 GB.

Preparing the Environment

Install F-Droid, then install Termux and Termux:API from it.

Google AdInline article slot

In Termux, run:

pkg update && pkg upgrade -y
pkg install proot-distro -y
proot-distro install ubuntu
proot-distro login ubuntu

In Ubuntu:

apt update && apt upgrade -y
apt install -y curl git build-essential
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
apt install -y nodejs
node -v  # v22.16+

Install OpenClaw:

Google AdInline article slot
npm install -g openclaw@latest
openclaw --version

Bypassing Bionic Errors

If the gateway crashes with os.networkInterfaces() or EACCES errors, apply this patch:

Create /root/bionic-bypass.js:

const os = require('os');
const _originalNetworkInterfaces = os.networkInterfaces;

os.networkInterfaces = function() {
  try {
    return _originalNetworkInterfaces.call(os);
  } catch (e) {
    return {
      lo: [{
        address: '127.0.0.1',
        netmask: '255.0.0.0',
        family: 'IPv4',
        mac: '00:00:00:00:00:00',
        internal: true,
        cidr: '127.0.0.1/8'
      }]
    };
  }
};

Command to create it:

Google AdInline article slot
cat <<'EOF' > /root/bionic-bypass.js
[code above]
EOF
echo 'export NODE_OPTIONS="-r /root/bionic-bypass.js"' >> ~/.bashrc
source ~/.bashrc

To revert: sed -i '/bionic-bypass/d' ~/.bashrc && rm -f /root/bionic-bypass.js && source ~/.bashrc.

Configuring and Launching the Gateway

Launch the setup wizard:

openclaw onboard

Select:

  • Gateway Bind: loopback (the only safe option without root).
  • Provider: OpenRouter (free models), Gemini, OpenAI.
  • Enter your API key.

Launch in tmux (install with apt install tmux):

tmux new -s oc
openclaw gateway --verbose

Detach: Ctrl+B, D. Reattach: tmux attach -t oc.

Web panel: http://127.0.0.1:18789. Token: openclaw config get gateway.auth.token.

Preventing Android from Killing the Process

  • Run termux-wake-lock in Termux.
  • Settings → Battery → Termux → No restrictions.
  • For Xiaomi/HyperOS:

- Battery → Background activity → Termux → No restrictions.

- Apps → Termux → Autostart: enable.

Verification checklist:

| Command/Action | Expected Result |

|------------------|---------------------|

| openclaw --version | Version displayed without errors |

| openclaw gateway --verbose | Runs for 30+ seconds |

| http://127.0.0.1:18789 | Control UI loads |

| Token in UI | Connection successful |

| Test message | AI response received |

Messenger Integration

Supported platforms: Telegram (grammY), WhatsApp (Baileys), Discord, Slack, Signal, and others. Configure via the onboard wizard or UI. Response delay on free models: 5–10 seconds.

Key Points

  • Use loopback binding to minimize security risks.
  • Store API keys in a secure configuration.
  • Update Node.js and OpenClaw via docs.openclaw.ai.
  • tmux is essential for session persistence.
  • Disable battery optimization completely.

— Editorial Team

Advertisement 728x90

Read Next