2.7 KiB
2.7 KiB
Android Builder
Android Builder is a Termux-oriented shell tool for bootstrapping simple Android app projects, installing the required Android SDK pieces, and building/exporting APKs from the command line.
Installation
Before installing:
- optionally run
termux-change-repo - run
pkg update - run
pkg upgrade -y - install
curlif it is not already present:pkg install -y curl
Then run the bootstrap installer inside Termux:
pkg update
pkg upgrade -y
pkg install -y curl
curl -fsSL https://git.dark98.co.uk/Dark98/Termux-Android-Builder/raw/branch/main/install.sh | bash
The bootstrapper will:
- install the required Termux packages
- clone or update the Android Builder checkout
- add
~/android-builder/binto yourPATH
Usage
After installation, the main command is:
android-builder help
Available commands:
android-builder setupandroid-builder doctorandroid-builder new MyAppandroid-builder wrapperandroid-builder new MyApp --template emptyandroid-builder buildandroid-builder export
Command Layout
The CLI is now split into smaller scripts for readability and maintenance:
bin/android-builderis the command dispatcher- shared helpers live in
lib/common.sh - individual command implementations live in
lib/commands/
Project Generation
android-builder new creates a basic Android app skeleton with:
- Gradle settings and properties
- a single
appmodule - vendored Gradle wrapper files for the generated project
- a minimal
MainActivity - a simple default theme and string resources
The template defaults are controlled in one place through environment variables:
ANDROID_BUILDER_GRADLE_VERSIONdefaults to8.7ANDROID_BUILDER_AGP_VERSIONdefaults to8.5.2ANDROID_BUILDER_GRADLE_DISTRIBUTION_SHA256defaults to the official checksum forgradle-8.7-bin.zip
The project generator and the generated projects themselves do not need a system gradle binary anymore.
Notes
- The project is designed around Termux.
android-builder setupinstalls the SDK command-line tools and platform packages into~/android-sdk.android-builder exportcopies the built APK into~/storage/documentsafter storage permission is granted.
Troubleshooting
- If
android-builder exportsays storage is not configured, runtermux-setup-storage, grant the permission prompt, then rerunandroid-builder export. - If
android-builder buildsays./gradlewis missing, regenerate the project withandroid-builder new <ProjectName>. - If you have an existing Android project and want to add wrapper files, run
android-builder wrapperfrom the project root. - If Android SDK packages are missing, rerun
android-builder setup.