1️⃣ What you’ll need
- Android phone (Android 10 +) – the target device.
- Wi‑Fi / ADB over USB – for downloading packages & the repo.
- Termux – terminal emulator + package manager.
- Android NDK (r26+) – C++ compiler & sysroot.
- Git, Python 3, pip – source control & scripts.
2️⃣ Setting up Termux
# 1️⃣ Update repos & install essentials
pkg update && pkg upgrade
pkg install clang cmake ninja-build git python3 python3-pip wget unzip
pkg install libffi-dev openssl-dev zlib-dev
# 2️⃣ Create a workspace
mkdir -p ~/openclaw && cd ~/openclaw
All commands are typed inside the Termux shell.
3️⃣ Download the OpenClaw source
# Clone the main repo
git clone https://github.com/openclaw/openclaw.git
cd openclaw
# Optional: checkout the latest release tag
# git checkout tags/X.Y
4️⃣ Install Python dependencies
# Upgrade pip and install requirements
pip3 install --upgrade pip
pip3 install -r requirements.txt
5️⃣ Build the C++ core
# Create a build directory
mkdir build && cd build
# Configure with the Android NDK toolchain
cmake .. -DCMAKE_BUILD_TYPE=Release \
-DANDROID_NDK=$(realpath $PREFIX) \
-DANDROID_TOOLCHAIN=clang \
-DCMAKE_TOOLCHAIN_FILE=$PREFIX/../android-ndk-r26b/build/cmake/android.toolchain.cmake \
-DANDROID_ABI=arm64-v8a # use armhf for 32‑bit
# Compile
ninja
After ninja finishes you’ll find libopenclaw.so and the openclaw executable in build/bin/.
6️⃣ Verify the binary works
# Make executable
chmod +x bin/openclaw
# Show help
./bin/openclaw --help
You should see the usage screen.
7️⃣ Using OpenClaw on the phone
Analyze a local APK
# Example APK
./bin/openclaw analyze ~/Downloads/example.apk -o ~/openclaw_output
Scan an installed app
# Pull APK via ADB
adb pull /data/app/com.example.foo-1/base.apk ~/Downloads/example.apk
# Run analysis
./bin/openclaw analyze ~/Downloads/example.apk -o ~/openclaw_output
8️⃣ Automate with a helper script
cat <<'EOF' > ~/openclaw/scan_app.sh
#!/usr/bin/env bash
PACKAGE=$1
OUT=${2:-~/openclaw_output}
APK=$(adb shell pm path "$PACKAGE" | cut -d: -f2 | tr -d '\r')
adb pull "$APK" ~/tmp
~/openclaw/bin/openclaw analyze ~/tmp/base.apk -o "$OUT"
rm -f ~/tmp/base.apk
EOF
chmod +x ~/openclaw/scan_app.sh
Run it with:
~/openclaw/scan_app.sh com.example.foo ~/my_report
9️⃣ Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
no such file or directory: 'android-ndk-r26b' | Wrong NDK path | Use realpath $PREFIX or download NDK manually |
undefined reference to __aeabi_unwind_cpp_pr0 | Wrong ABI | Re‑run CMake with -DANDROID_ABI=armhf or arm64-v8a |
| Python import errors | Missing libs | Run pip3 install -r requirements.txt again |
| Out‑of‑memory during ninja | Device RAM low | Use ninja -j1 or build on PC |
🔟 Going beyond the basics
- Cross‑compile on PC – Build on a laptop and copy
openclawback. - Rooted phone tricks – Install into
/system/binor usesu. - CI pipelines – Wrap
scan_app.shin Jenkins or GitHub Actions. - Community plugins – Check
openclaw‑pluginsrepo.
🗒️ TL;DR – One‑liner
pkg update && pkg upgrade && pkg install clang cmake ninja-build git python3 python3-pip wget unzip \
&& git clone https://github.com/openclaw/openclaw.git && cd openclaw && pip3 install -r requirements.txt \
&& mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DANDROID_ABI=arm64-v8a && ninja \
&& ./bin/openclaw --help