A modern, production-ready Android template built with Jetpack Compose and Kotlin. This template provides a solid foundation for building Android applications with best practices, comprehensive testing, and CI/CD already configured.
- Click the Use this template button to create a new repository
- Clone your new repository
- Update the following files with your project details:
buildSrc/src/main/kotlin/dev/shtanko/template/Configuration.kt
- Update version and SDK configurationsapp/src/main/AndroidManifest.xml
- Update package name and permissionslibrary-android/src/main/AndroidManifest.xml
- Update package name- Rename package directories to match your project structure
# Build the project
./gradlew build
# Run tests
./gradlew test
# Run linting and code analysis
./gradlew detekt
# Format code
./gradlew spotlessApply
This template follows a modular architecture with the following structure:
βββ app/ # Main Android application module
βββ library-android/ # Android library module
βββ library-kotlin/ # Kotlin-only library module
βββ buildSrc/ # Build configuration and dependencies
βββ gradle/ # Version catalogs and build scripts
βββ config/ # Static analysis configuration
βββ .github/workflows/ # CI/CD workflows
- app: Main Android application with Compose UI
- library-android: Reusable Android components and utilities
- library-kotlin: Platform-agnostic business logic and data models
- Kotlin - Primary programming language
- Jetpack Compose - Modern UI toolkit
- Material 3 - Design system
- Android Gradle Plugin 8.10.1 - Build system
- Gradle Kotlin DSL - Build configuration
- Hilt - Dependency injection
- Room - Local database
- Retrofit + OkHttp - Network communication
- Kotlinx Serialization - JSON serialization
- Paging 3 - Pagination support
- Navigation Compose - Navigation
- WorkManager - Background tasks
- Coil - Image loading
- JUnit 5 - Unit testing
- Espresso - UI testing
- Robolectric - Android framework testing
- Mockito/MockK - Mocking
- Turbine - Flow testing
- Roborazzi - Screenshot testing
- Detekt - Static code analysis
- KtLint - Code formatting
- Spotless - Code formatting
- SonarQube - Code quality analysis
- Kover - Code coverage
- Jacoco - Coverage reporting
- Material 3 Design System - Modern, adaptive design
- Dark/Light Theme Support - Complete theming system
- Responsive Layout - Adaptive to different screen sizes
- Accessibility Support - WCAG compliance ready
- Splash Screen - Modern splash screen implementation
- Hot Reload - Fast development with Compose
- Type Safety - Full Kotlin type safety
- Auto-completion - Enhanced IDE support
- Debug Tools - Comprehensive debugging utilities
- Baseline Profiles - Performance optimization
- Benchmarking - Performance measurement tools
- Memory Leak Detection - Built-in memory analysis
- ProGuard/R8 - Code optimization and obfuscation
The project uses centralized dependency management through gradle/libs.versions.toml
:
// Example dependency usage
implementation(libs.androidx.compose.ui)
implementation(libs.androidx.navigation.compose)
implementation(libs.hilt.android)
Configure code quality tools in their respective config files:
- Detekt:
config/detekt/detekt.yml
- KtLint: Configured via Gradle plugin
- Spotless: Configured in
build.gradle.kts
The template includes GitHub Actions workflows for:
- Build & Test: Automated testing on every PR
- Code Quality: Static analysis and formatting checks
- Publishing: Automated library publishing (configurable)
# Run all unit tests
./gradlew testDebugUnitTest
# Run tests with coverage
./gradlew koverHtmlReport
# Run Espresso tests
./gradlew connectedAndroidTest
# Run screenshot tests
./gradlew updateDebugScreenshotTest
./gradlew validateDebugScreenshotTest
# Run static analysis
./gradlew detekt
# Check code formatting
./gradlew ktlintCheck
# Apply code formatting
./gradlew spotlessApply
The template is configured for publishing to Maven Central. Configure the following secrets:
Secret | Description |
---|---|
ORG_GRADLE_PROJECT_NEXUS_USERNAME |
Sonatype username |
ORG_GRADLE_PROJECT_NEXUS_PASSWORD |
Sonatype password |
ORG_GRADLE_PROJECT_SIGNING_KEY |
GPG private key |
ORG_GRADLE_PROJECT_SIGNING_PWD |
GPG passphrase |
- Snapshot Publishing: Automatic on merge to main
- Release Publishing: Triggered by version tags
Use the provided Makefile for common tasks:
# Build and test everything
make default
# Run code quality checks
make check
# Format code
make spotless
# Generate coverage report
make kover
# Run screenshot tests
make screenshot
- Android Studio - Latest stable version
- JDK 17 - Java Development Kit
- Android SDK - API level 33+ (Android 13+)
- Gradle - 8.0+ (included via wrapper)
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests and quality checks
- Submit a pull request
- Follow Kotlin coding conventions
- Write unit tests for new features
- Ensure all CI checks pass
- Update documentation as needed
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
- Built on top of the excellent kotlin-android-template
- Uses modern Android development best practices
- Incorporates community-driven improvements
Ready to build amazing Android apps? π Start with this template and focus on what matters most - your app's features and user experience!