Something went wrong. Try again.
An Android TV app template.
Something went wrong. Try again.
Shell 72%
Nix 12%
Dockerfile 9%
Java 7%
README.md
Android TV template #
Template for an Android TV (Leanback) app.
Prerequisites #
- JDK 17+
- Android SDK (platform
android-28, build-tools34.0.0)
Build #
Direct (gradlew) #
./gradlew assembleDebug
APK output: app/build/outputs/apk/debug/app-debug.apk
Nix flake #
nix develop
# or enter a subshell: nix develop --command ./gradlew assembleDebug
The flake provides JDK 17, Gradle, and the Android SDK (platform 28 & 34, build-tools 34.0.0) with ANDROID_SDK_ROOT and ANDROID_HOME set automatically. No extra environment variables or --impure needed — the flake already accepts the Android SDK license and allows unfree packages via nixpkgs.config.
Testing on a device/emulator #
# Install APK
adb install app/build/outputs/apk/debug/app-debug.apk
# Run Leanback emulator (if not already running)
# Use an AVD with target "Android TV (Android 9)" — API 28
Docker build #
docker build -t android-tv-builder .
docker run --rm -v $(pwd)/output:/output android-tv-builder
APK is written to ./output/app-debug.apk.
CI #
Every push/PR to main triggers a GitHub Actions workflow that builds the APK and uploads it as a build artifact.
Project structure #
app/
├── build.gradle
└── src/main/
├── AndroidManifest.xml # Uses LEANBACK_LAUNCHER category
├── java/…/MainActivity.java # Single activity entry point
└── res/
├── layout/activity_main.xml
├── values/styles.xml
└── mipmap-anydpi-v26/ # Adaptive icons
The manifest declares android.intent.category.LEANBACK_LAUNCHER — this is what makes it an Android TV app on compatible devices and the Play Store.