AAPC is a small CLI tool designed to compile Android Gradle projects directly from an Android device using Termux.
It consists of two shell scripts:
install_env.sh– prepares the Termux environment (OpenJDK, Gradle, Android SDK & optional NDK).androidappscompile.sh– interactive CLI to select projects and run Gradle debug builds with different error/detail levels.
Target use case:
Developers who want to build Android apps on-device without opening a PC, or who want a lightweight build helper for multiple projects.
-
📁 Project discovery
Scans a dedicated directory on internal storage for Android Gradle projects that containgradlew. -
🔢 Interactive project selection
Shows a numbered list of available projects and lets you pick by number. -
⚙️ Build modes
For the selected project, you can choose:- Normal compile (
assembleDebug) - Compile with error stacktrace
- Compile with detailed logs (
--stacktrace --info)
- Normal compile (
-
📦 APK export helper
On successful build, the debug APK is:- Detected automatically under the project’s build outputs
- Copied to a common
Buildsdirectory as
<project-name>-debug-latest.apk
-
🧩 Environment installer
install_env.shcan:- Install OpenJDK, Gradle, git, unzip, wget in Termux
- Download & extract Android SDK for Termux (aarch64)
- Optionally download & extract Android NDK for Termux (aarch64)
- Append environment variables to your shell config (
ANDROID_SDK_ROOT,ANDROID_HOME,NDK_HOME,PATH)
- Android device (64-bit / aarch64 recommended)
- Termux from a trusted source (F-Droid or official)
- Android 9.0+
- Enough RAM for Gradle builds (4 GB+ is better, heavy projects may need more)
- Gradle-based Android projects (with
gradlewand at least one Android module)
- Clone this repository
git clone https://github.com/Gustyx-Power/AAPC-AndroidAppsCompiler.git
cd AAPC-AndroidAppsCompiler- Make the scripts executable
chmod +x install_env.shchmod +x androidappscompile.sh- Run the environment installer
bash install_env.shDuring this step:
- Required Termux packages (OpenJDK, git, unzip, wget, gradle) will be installed.
- You will be asked whether you want to download:
- Android SDK for Termux (aarch64)
- Android NDK for Termux (needed for native C/C++ projects)
- Apply environment variables After install_env.sh finishes, reload your shell config:
source ~/.bashrcsource ~/.zshrc-
Usage tools
-
Prepare your projects Place your Android Gradle projects in a dedicated directory on internal storage (for example under /sdcard/AppsCompile). Each project should include its own gradlew wrapper and a standard Android module (e.g. an app module).
-
Launch the main tool From the repository directory (or anywhere, if the script is in your $PATH):
bash androidappscompile.sh-
Select a project The tool will list all projects it detects and ask you to choose a number.
-
Choose a build mode You can pick:
- Normal compile →
./gradlew assembleDebug - Compile with error check →
./gradlew assembleDebug --stacktrace - Detailed error →
./gradlew assembleDebug --stacktrace --info
- Get the APK On successful build: The debug APK is found in the project’s build output. A copy is also placed in a common Builds directory as -debug-latest.apk, ready to install or share.
- Currently focused on debug builds (
assembleDebug). - Release builds (
assembleRelease) require a proper signing config in your Gradle files and are not automated yet. - Performance depends heavily on your device:
- Large Kotlin/Compose projects can be slow and memory-hungry.
- Long builds can heat up the device; consider taking breaks between builds.
- The Android SDK/NDK used by the installer comes from a third-party Termux-focused project (see Credits).
Possible future improvements:
- Menu options for:
assembleReleasecleanorclean assembleDebug
- Optional
--offlineflag for Gradle builds. - Colored output (ANSI) for better readability.
- Simple config file for:
- default build type
- output paths
- SDK/NDK locations
-
Author / Maintainer
Gustyx-Power- Concept, shell scripts, project design, and overall idea.
-
Termux Android SDK/NDK (aarch64)
lzhiyong/termux-ndk- Provides prebuilt Android SDK & NDK for Termux aarch64, used by
install_env.sh.
- Provides prebuilt Android SDK & NDK for Termux aarch64, used by
-
Termux Project
Termux- Terminal emulator & Linux environment for Android that makes this tool possible. If you extend this tool or use it in your own workflow, feel free to add your name in a future Contributors section.