Minimal Android app template that builds entirely on-device in Termux. No Gradle, no Android Studio — just aapt2, ecj, d8, and apksigner.
Includes a Material Light UI with d-pad/keyboard focus support, a self-update mechanism (GitHub Releases), and an info screen with profile/repo links.
Install the required packages:
pkg install aapt2 ecj dx apksigner zipYou also need these files in ~/.android/:
| File | What it is | Where to get it |
|---|---|---|
android.jar |
Android API stubs | Extract from an Android SDK (platforms/android-XX/android.jar) or copy from a device at /system/framework/framework.jar |
framework-res.apk |
System resource definitions | Copy from a device: adb pull /system/framework/framework-res.apk |
debug.keystore |
Signing key | Generate: keytool -genkey -v -keystore ~/.android/debug.keystore -alias androiddebugkey -keyalg RSA -keysize 2048 -validity 10000 -storepass android -keypass android -dname "CN=Debug" |
chmod +x build.sh
./build.shOutput APK name is derived from the name field in project.json (spaces stripped). For example, "name": "My App" produces MyApp.apk.
├── project.json # App identity and constants
├── VERSION # Semver string (e.g. 1.0.0)
├── build.sh # Build pipeline
├── AndroidManifest.xml # App manifest (synced by build.sh)
├── res/
│ ├── drawable/ # Button/card/focus state drawables
│ ├── layout/ # activity_main.xml, activity_info.xml
│ ├── mipmap-anydpi-v26/ # Adaptive icon
│ └── values/ # colors.xml, themes.xml, strings.xml
├── src/ # Java source (package path)
├── libs/ # Optional jars (auto-included in classpath)
├── tmp/ # Scratch space (gitignored)
└── build/ # Build artifacts (gitignored)
project.json holds app identity — edit this first:
{
"package": "com.flipphoneguy.app",
"name": "App Template",
"min_sdk": 23,
"target_sdk": 35,
"repo": "flipphoneguy/app-template",
"github_profile": "https://github.com/flipphoneguy"
}VERSION is a single-line semver (1.0.0). Bump this for releases. build.sh reads it to set versionCode and versionName in the manifest and in BuildConfig.java.
Version code formula: major * 10000 + minor * 100 + patch.
- Copy the directory
- Edit
project.json(package, name, repo, etc.) - Rename
src/com/flipphoneguy/app/to match your package path - Find-replace
package com.flipphoneguy.appin all.javafiles - Set
VERSIONto1.0.0 - Run
./build.sh
build.sh syncs AndroidManifest.xml with your project.json values automatically on each build (package, version, provider authority).
- Material Light theme, indigo color palette
- Card-based layout with rounded corners
- D-pad/keyboard focus support: declarative
nextFocusUp/Downchains on all interactive elements, visible focus states (white border on buttons, indigo highlight on cards)
- Checks GitHub Releases API for a newer version
- Downloads APK, then prompts user to choose install method:
- Root: copies to
/data/local/tmp, runspm install -r - System installer: launches the system package installer via intent
- Root: copies to
build.shreadsproject.json+VERSION, generatesBuildConfig.javawith compile-time constants (VERSION_NAME,REPO,GITHUB_PROFILE, etc.)- 5-step pipeline: compile resources, link, compile Java, dex, package+sign
- Jars in
libs/are automatically added to the classpath and dexed
# via adb
adb install -r AppTemplate.apk
# on-device
cp AppTemplate.apk /sdcard/ && pm install -r /sdcard/AppTemplate.apkSee LICENSE.