A robust, dependency-aware automated installer that configures community-built native aarch64 Android NDKs and CMake toolchains for AndroidIDE and Termux — enabling on-device compilation of native C/C++ Android projects without a PC.
⚡ One-Line Install • ✨ Why This Exists • 📦 Supported Versions • ⚙️ CLI Usage • 🔧 AndroidIDE Setup
Run this single command inside the AndroidIDE Terminal or Termux:
curl -sL https://raw.githubusercontent.com/cyb3rdr4g0n17/AndroidIDEInstaller/main/ndk-install.sh | bashwget -qO- https://raw.githubusercontent.com/cyb3rdr4g0n17/AndroidIDEInstaller/main/ndk-install.sh | bashTip
The installer automatically detects your environment, verifies required tools (tar, unzip, xz), locates your Android SDK folder, and applies all necessary toolchain symlinks and CMake host patches.
Official Google NDK binaries are pre-compiled exclusively for x86_64 host machines (Linux, Windows, macOS). When developing and compiling Android applications directly on an Android device using AndroidIDE, Gradle fails to execute standard NDK binaries because the phone's CPU architecture is aarch64 (ARM64).
This installer bridges that gap by:
- Fetching Native ARM64 Builds: Downloads reliable, community-compiled aarch64 NDKs (glibc and lightweight musl binaries) built specifically for Android hosts.
- Automating Complex Host-Tag Patches: Official CMake toolchain scripts look for
linux-x86_64host directories. This tool automatically injects host tag overrides (ANDROID_HOST_TAG = linux-aarch64) and configures required prebuilt symlinks. - Resilient Network Engine: Downloads multi-hundred megabyte archives with automatic resume capability, retry loops, and archive checksum/integrity testing.
- Selective CMake Ingestion: Rather than forcing every CMake version onto your phone's storage, it allows selective installation of the exact CMake version needed for your Gradle project.
| NDK Release | Revision Code | Toolchain Type | Host Library | Recommended For |
|---|---|---|---|---|
| r28b | 28.1.13356709 |
Clang / LLVM 19 | musl native | Latest Stable (Modern AGP 8.x+) |
| r27c | 27.2.12479018 |
Clang / LLVM 18 | musl native | High Performance & Stability |
| r27b | 27.1.12297006 |
Clang / LLVM 18 | glibc | Standard modern toolchain |
| r26b | 26.1.10909125 |
Clang / LLVM 17 | glibc | Stable modern toolchain |
| r23b | 23.2.8568313 |
Clang / LLVM 12 | glibc | LTS Recommended for older projects |
| r21e | 21.4.7075529 |
Clang / LLVM 9 | glibc | Legacy LTS |
| r17c – r24 | Various | GCC / Clang | glibc | Specialized legacy codebases |
| r29-beta1 | 29.0.13113456 |
Clang / LLVM 20 | musl native | Cutting-edge preview testing |
3.22.1(Recommended) — Default version required by modern Android Gradle Plugin (AGP 7.0–8.x).3.25.1— For projects utilizing bleeding-edge CMake directives.3.18.1&3.10.2— For legacy projects and older Gradle setups.
You can run ndk-install.sh non-interactively in shell scripts or Termux workflows:
# Clone the repository
git clone https://github.com/cyb3rdr4g0n17/AndroidIDEInstaller.git
cd AndroidIDEInstaller
chmod +x ndk-install.sh
# Display help and options
./ndk-install.sh --help
# List all available NDK & CMake versions
./ndk-install.sh --list
# Install specific NDK (r27c) and recommended CMake without prompts
./ndk-install.sh -v r27c -c recommended -y
# Specify a custom Android SDK directory
./ndk-install.sh -v r26b -c 3.22.1 -d /storage/emulated/0/AndroidIDE/android-sdk| Flag | Parameter | Description |
|---|---|---|
-v, --version |
<name> |
Specify NDK version to install (e.g. r27c, r26b, r28b). |
-c, --cmake |
<option> |
Choose CMake: recommended (3.22.1), modern (3.25.1), all, or none. |
-d, --dir |
<path> |
Override Android SDK destination path. |
-l, --list |
None | Print all supported NDK and CMake versions. |
-y, --yes |
None | Automatically accept confirmation prompts. |
-h, --help |
None | Display command usage and flags. |
Once the script completes successfully:
- Restart AndroidIDE to register the new toolchain paths.
- In your project's
android/local.properties(orlocal.properties), ensure your SDK directory matches:sdk.dir=/storage/emulated/0/AndroidIDE/android-sdk ndk.dir=/storage/emulated/0/AndroidIDE/android-sdk/ndk/27.2.12479018
- In your app's
build.gradle(orbuild.gradle.kts), specify the installed NDK version:android { ndkVersion "27.2.12479018" // Matches installed NDK directory name externalNativeBuild { cmake { path "src/main/cpp/CMakeLists.txt" version "3.22.1" } } } - Trigger Sync Project with Gradle Files inside AndroidIDE and build your native project.
1. "wget: command not found" or "unzip: command not found"
The installer automatically attempts to install missing packages usingpkg install or apt. If you are in a constrained shell, run:
pkg update && pkg install -y wget curl unzip tar xz-utils2. "Permission denied" when moving NDK to /storage/emulated/0/
If your SDK is located on shared internal storage, grant storage permissions to your terminal app:termux-setup-storage~/android-sdk.
3. Which NDK version should I choose?
For modern Android development, r27c or r28b (musl native) provides the fastest compilation times and smallest binary footprint on aarch64 devices. If using an older open-source library, r23b or r21e offers maximum backward compatibility.- MrIkso — Original NDK/CMake port builds and foundation script.
- HomuHomu833 — High-performance musl-based ARM64 NDK toolchain distributions.
- jzinferno2 — Termux NDK release archives.
- AndroidIDE Team — For developing a full-featured Android development IDE on Android.
This project is licensed under the MIT License. See the LICENSE file for details.