A complete, no-root Android build toolchain for Termux.
Compile, sign, install, and launch real .apk files entirely on-device — no PC, no Android Studio, no root.
Termux Studio turns a stock Android phone into a self-contained Android development machine. It bundles a self-built native aarch64 aapt2 (so it can parse modern SDK 35/36/37 resources that Termux's packaged aapt2 cannot) and a friendly studio CLI + TUI that handles Gradle builds, signing, wireless adb install/launch, logcat, and multi-JDK management — the same things Android Studio does, but from a terminal on your phone.
Keywords: build Android apps on Termux · compile APK on Android without root · Android Studio alternative on phone · Gradle build in Termux · native aarch64 aapt2 · on-device APK signing · Jetpack Compose on Android phone.
- 🏗️ One-command builds —
studio buildruns Gradle with the right toolchain (system Gradle, native aapt2, JDK pin) without touching your project's committed Android Studio config. - 📦 Native aarch64
aapt2— self-built from AOSP source; parses Android SDK 35/36/37resources.arscthat Termux's stock aapt2 chokes on. ▶️ Run on device like the green ▶ —studio runbuilds, installs and launches over Shizuku, wirelessadb(Android 11+, no root/USB), or the system package installer with verified-install detection.- ⚡ Shizuku 1-click silent installs —
studio run --shizukuinstalls APKs without adb pairing or root via a persistent held-binder bridge. Supports headless--no-launchfor agents/CI. - 🛠️ Native C/C++ support (NDK & CMake) —
studio ndk installsets up verified aarch64 NDK toolchains (r29,r28c,r27d,r26d) and CMake so native C/C++ modules build out of the box. - 🚀 Warmed daemons & live console — RAM-tuned persistent daemons (clean builds ~3x faster, incremental ~5x faster) with live Gradle progress bars auto-fitted to narrow mobile screens.
- 🔄 Signature-mismatch self-healing — Automatically uninstalls and replaces outdated conflicting test APKs on
INSTALL_FAILED_UPDATE_INCOMPATIBLEwithout manualpm uninstall. - 🔐 Release signing made easy — pick a keystore alias after entering the password, remember keystore details, or create a keystore step-by-step; auto-signs with a debug key if you have none.
- 💾 Remember preferences — save preferred build/run flags, keystores, and APK names with
--remember, or inspect withstudio remember. - 🎯 Direct Gradle tasks —
studio gradle [path] <tasks...>runs unit tests, linters (testDebugUnitTest,:app:lintDebug), or custom tasks with Termux's toolchain pre-configured. - 🏷️ Smart APK naming — release APKs are renamed to
<App Name>_<version>.apk, or set your own with--apk-name. - 📤 Share from the terminal — push the built APK straight to the Android share sheet (APK, or ZIP-wrapped for apps that reject APKs).
- ☕ Multi-JDK — install/manage JDK 11/17/21 and auto-select the right one per project's Gradle/AGP.
- 🧩 Imports "just work" — clone any repo (
studio clone <url>) and the compatibility adapter auto-adapts Gradle version, missing SDK levels, AGP and JDK — reversibly, so git stays pristine. - 🖥️ Interactive TUI —
studio startgives a menu-driven UI that remembers and auto-reopens your last project. - 🆕 Project generator —
studio new "My App" --composescaffolds a ready-to-build Compose or XML/Views project.
- Why this exists
- Requirements
- Installation
- Quick start
- Command reference
- How it works
- Rebuilding aapt2 from source
- FAQ
- Contributing
- License
Building Android apps on a phone with Termux normally fails for three reasons, all of which Termux Studio solves:
| Blocker | What breaks | Fix |
|---|---|---|
| aapt2 architecture/version | AGP downloads an x86_64 aapt2 (won't run on ARM); Termux's packaged aapt2 is too old to read SDK 35+ resources | ships a self-built native aarch64 aapt2 and wires it in via aapt2FromMavenOverride |
./gradlew is non-executable |
/storage is mounted noexec, so the Gradle wrapper can't run |
uses the system Gradle, provisioning the project's version when the major differs |
| JetBrains JDK pin | gradle-daemon-jvm.properties pins a JBR that Termux lacks |
moves it aside per-build (restored after) and pins Termux's OpenJDK |
Everything Termux-specific lives in ~/.gradle and ~/.studio — your repo and its Android Studio configuration are never modified.
- Termux (from F-Droid or GitHub — not the outdated Play Store build) on Android 11+, aarch64.
- ~3 GB free space for the SDK + Gradle + JDKs (downloaded by the installer).
- Optional: the Termux:API app for share/clipboard, and a one-time Wireless debugging pairing for
adbinstall/launch/logcat.
pkg install -y git
git clone https://github.com/poordevcode/termux-android-studio.git ~/termux-studio
bash ~/termux-studio/install.sh
source ~/.bashrcThe installer pkg-installs the JDKs/Gradle, downloads + configures the Android SDK, overlays the native aapt2, installs the studio tooling, and writes your ~/.gradle/gradle.properties. Flags: -y (non-interactive), --no-sdk (keep an existing SDK), --build-aapt2 (compile aapt2 from source — needed on non-aarch64). Finish with studio doctor to verify.
studio new "My App" --compose --build # scaffold + build a Jetpack Compose app
studio run ~/AndroidStudioProjects/MyApp # build → install → launch on device (auto-replaces older signatures)
studio run ~/AndroidStudioProjects/MyApp --shizuku # 1-click silent install via Shizuku (no adb needed)
studio gradle ~/AndroidStudioProjects/MyApp testDebugUnitTest # run unit tests
studio ndk install # one-time aarch64 NDK setup for native C/C++ builds
studio start # interactive TUI (auto-reopens last project)| Command | What it does |
|---|---|
studio new [name] [--compose|--xml] [--build] |
Scaffold a new project |
studio clone <git-url> |
Clone + import a repo (like AS "Get from VCS") |
studio load [path] |
Adapt an existing project for Termux |
studio build [path] [tasks…] |
Build (default :app:assembleDebug) |
studio build … assembleRelease --apk-name NAME |
Signed release with a custom output name |
studio run [path] [--release] [--shizuku] [--logcat] |
Build, install & launch (Shizuku, wireless adb, or package installer) |
studio gradle [path] <tasks/args…> |
Run any Gradle task (test, lint, etc.) with Termux toolchain |
studio shizuku {status|start|restart|sync|install} |
Manage Shizuku integration & silent background installs |
studio ndk {list|install [ver]|use <ver>|which} |
Manage native aarch64 NDKs (r29/r28c/r27d/r26d) & C/C++ builds |
studio jdk {list|install|use|which} |
Manage build JDKs (11/17/21) |
studio adb {pair|connect|disconnect|status} |
Wireless debugging setup (Android 11+, no root/USB) |
studio logcat [pkg|path] |
Stream the app's debug logs |
studio remember [clear] [path] |
Show or clear remembered build/run choices |
studio doctor |
Diagnose the environment and toolchain |
studio start |
Launch the interactive TUI |
- Native aapt2 built from AOSP
platform-tools-35.0.2, patched for Termux clang 21 / Android 14, is installed intobuild-tools/36.0.0/aapt2and referenced byandroid.aapt2FromMavenOverride— the single override modern AGP needs (d8/zipalign/apksigner come from AGP's own bundled tools). - Per-build isolation: the JetBrains daemon-JVM pin is stashed outside the repo and restored on exit; any compatibility patch (SDK cap, AGP bump, dropped buildTools pin) is reverted after the build.
git statusstays clean. - Auto-JDK: the compatibility adapter picks the lowest installed JDK that satisfies the effective Gradle + AGP versions, only overriding the default when needed.
The shipped binary is in prebuilt/aapt2-aarch64. To reproduce it:
bash aapt2-build/clone_aapt2_src.sh # clone the AOSP repos aapt2 needs (tag platform-tools-35.0.2)
bash aapt2-build/apply_aapt2_patches.sh # Termux/clang-21 patches
# configure + build with cmake/ninja — see the scripts and README notesKey flags: --target=aarch64-linux-android34 (bionic fdsan), -DFMT_CONSTEVAL=, and -DCMAKE_EXE_LINKER_FLAGS="--target=aarch64-linux-android34 -L/system/lib64 -llog". Output: build-aapt2/bin/build-tools/aapt2 → copy over prebuilt/aapt2-aarch64.
Does this need root? No. Installs can go through Shizuku (silent background install without adb pairing), wireless adb (Android 11+ loopback pairing), or the standard system package installer. None require root.
How does Shizuku installation work? If you have Shizuku running, pass --shizuku to studio run (e.g. studio run --shizuku). It communicates directly with the Shizuku server using a persistent held-binder bridge to perform pm install silently in the background.
Can I build projects with C/C++ native code (NDK)? Yes! Run studio ndk install to download a native aarch64 NDK (r29 by default, or pick from r28c, r27d, r26d) and CMake. AGP detects the toolchain automatically.
What happens if an app has a different signing signature already installed? studio run automatically detects INSTALL_FAILED_UPDATE_INCOMPATIBLE, uninstalls the mismatched build, and installs the fresh APK so development iteration is never blocked. (Pass --no-uninstall if you want to prevent automatic removal).
Will it mess up my Android Studio project? No. All Termux tweaks live in ~/.gradle/~/.studio; in-repo build patches are reverted automatically.
Sharing an APK to WhatsApp crashes / is rejected. WhatsApp blocks raw .apk shares. Use the share menu's ZIP mode — the recipient unzips to get the installable APK. Other apps (Telegram, Drive, Bluetooth, Files) accept the APK directly.
Which Android/SDK versions? Android 11+ device; builds target up to SDK 37 (capped to the native aapt2's max).
Non-aarch64 device? Run install.sh --build-aapt2 to compile aapt2 for your architecture.
Issues and PRs welcome — device/Android-version reports, additional templates, and aapt2 rebuilds for new SDK levels are especially useful. ⭐ Star the repo if it helped you build on your phone.
Apache-2.0. The bundled aapt2 is built from the Android Open Source Project (Apache-2.0); see NOTICE.
Android app development on Termux • on-device APK builder • Android Studio for Android phones • no-root Gradle/AGP • aarch64 aapt2.