Files
Termux-Android-Builder/README.md
T
2026-07-02 05:33:07 +01:00

77 lines
2.2 KiB
Markdown

# 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 `curl` if it is not already present: `pkg install -y curl`
Then run the bootstrap installer inside Termux:
```bash
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/bin` to your `PATH`
## Usage
After installation, the main command is:
```bash
android-builder help
```
Available commands:
- `android-builder setup`
- `android-builder doctor`
- `android-builder new MyApp`
- `android-builder new MyApp --template empty`
- `android-builder build`
- `android-builder export`
## Command Layout
The CLI is now split into smaller scripts for readability and maintenance:
- `bin/android-builder` is 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 `app` module
- 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_VERSION` defaults to `8.7`
- `ANDROID_BUILDER_AGP_VERSION` defaults to `8.5.2`
- `ANDROID_BUILDER_GRADLE_DISTRIBUTION_SHA256` defaults to the official checksum for `gradle-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 setup` installs the SDK command-line tools and platform packages into `~/android-sdk`.
- `android-builder export` copies the built APK into `~/storage/documents` after storage permission is granted.