A modern and scalable Android application template. Provides production-ready multi-module environment, best practices, automated tooling, and comprehensive development utilities.
Design Philosophy:
- Flexible architecture supporting both standalone Android projects and KMP (Kotlin Multiplatform) library integration
- Modern tech stack with Jetpack Compose
- Comprehensive development tooling and automation
- Accessibility-first approach with built-in preview support
- Modular Structure: Clean separation with
app,core, andfeaturemodules - Convention Plugins: Reusable Gradle configuration with type-safe accessors
- Dependency Injection: Koin for lightweight DI without annotation processing
- Build Optimization: Parallel execution, configuration cache, and optimized R classes
- Automation Scripts:
convert-project.sh- Convert template to your projectcreate-module.sh- Generate new modules interactively
- Code Quality: Detekt with Compose rules and auto-formatting
- CI/CD: GitHub Actions workflows for testing and static analysis
- Design System Module (
core:designsystem): Theme and styling - UI Module (
core:ui): Reusable components and utilitiesDebouncedClickable- Prevents double-click issues- Preview annotations for screens and components
Two types of preview annotations for efficient UI development:
PreviewScreen - For screen-level composables (8 previews)
- Light/Dark themes × Phone/Tablet devices × Standard/Large font scales
- Shows system UI and device frames
- Ensures responsive design and accessibility
PreviewComponent - For component-level composables (4 previews)
- Light/Dark themes × Standard/Large font scales
- Quick preview without device frames
- Focuses on component behavior
- Kotlin: 2.2.21
- Gradle: 8.13 with version catalogs
- Android Gradle Plugin: 8.12.3
- Compose BOM: 2025.10.01
- Min SDK: 29 (Android 10)
- Target SDK: 36
- Dependency Injection: Koin 4.1.1
- Navigation: Navigation Compose 2.9.5
- Serialization: Kotlinx Serialization 1.9.0
- Code Quality: Detekt 1.23.8 with Compose rules
Create a new repository from this template on GitHub:
- Click the "Use this template" button at the top of this repository
- Choose "Create a new repository"
- Enter your repository name and settings
- Click "Create repository"
- Clone your new repository locally:
git clone git@github.com:YOUR_USERNAME/YOUR_REPO_NAME.git cd YOUR_REPO_NAME
Run the conversion script to customize the template:
chmod +x scripts/convert-project.sh
./scripts/convert-project.shThe script will interactively ask for:
- Package name (e.g.,
com.example.myapp) - Project name (e.g.,
my-app) - Convention plugin ID (e.g.,
myapp) - Theme name (e.g.,
MyApp) - Application class name (e.g.,
MyAppApplication)
Open the project in Android Studio and sync Gradle:
./gradlew clean buildCreate new modules using the module creation script:
chmod +x scripts/create-module.sh
./scripts/create-module.shandroid-template/
├── app/ # Main application module
├── core/
│ ├── designsystem/ # Theme, colors, typography
│ └── ui/ # Reusable UI components and previews
├── build-logic/ # Convention plugins
│ └── convention/ # Gradle convention plugins
├── config/ # Configuration files (Detekt)
├── scripts/ # Automation scripts
├── .github/workflows/ # CI/CD workflows
└── gradle/ # Gradle wrapper and version catalog
Custom Gradle plugins for consistent module configuration:
| Plugin | Purpose | Usage |
|---|---|---|
androidtemplate.android.application |
App module setup | Main application |
androidtemplate.android.library |
Basic library module | Data, domain layers |
androidtemplate.android.library.compose |
Compose library module | UI libraries with Compose |
androidtemplate.android.feature |
Feature module setup | Feature modules |
androidtemplate.detekt |
Static analysis | Code quality checks |
Converts the template to your project with custom naming. Run once when starting a new project.
./scripts/convert-project.shInteractively creates new modules with proper package structure.
./scripts/create-module.shOptions:
- Core Library (compose/non-compose)
- Feature Module
- Custom path
Two GitHub Actions workflows are included:
-
Test Workflow (
.github/workflows/test.yml) - Runs on PR/push- Unit tests with coverage
- Test reports uploaded as artifacts
-
Detekt Workflow (
.github/workflows/detekt.yml) - Static analysis- Code quality checks
- Compose-specific rules
-
Create a feature module:
./scripts/create-module.sh
Select "Feature Module" option.
-
Add dependencies in the module's
build.gradle.kts
Edit gradle/libs.versions.toml for centralized dependency management:
[versions]
mylib = "1.0.0"
[libraries]
mylib = { group = "com.example", name = "mylib", version.ref = "mylib" }Then use in modules:
dependencies {
implementation(libs.mylib)
}Run Detekt before committing:
./gradlew detektContributions are welcome! Please feel free to submit issues and pull requests.
モダンでスケーラブルなAndroidアプリケーションテンプレート。本番環境で使用可能なマルチモジュール環境、ベストプラクティス、自動化ツール、包括的な開発ユーティリティを提供します。
設計思想:
- 単体のAndroidプロジェクトとKMP(Kotlin Multiplatform)ライブラリ統合の両方に対応できる柔軟なアーキテクチャ
- Jetpack Composeを使用したモダンな技術スタック
- 包括的な開発ツールと自動化
- アクセシビリティファーストのアプローチとプレビューサポート
- モジュール構造:
app、core、featureモジュールによる明確な分離 - Convention Plugins: 型安全なアクセサによる再利用可能なGradle設定
- 依存性注入: アノテーション処理不要の軽量DIとしてKoinを使用
- ビルド最適化: 並列実行、設定キャッシュ、最適化されたRクラス
- 自動化スクリプト:
convert-project.sh- テンプレートをプロジェクトに変換create-module.sh- 対話的に新規モジュールを生成
- コード品質: Composeルールと自動フォーマット対応のDetekt
- CI/CD: テストと静的解析用のGitHub Actionsワークフロー
- Design Systemモジュール (
core:designsystem): テーマとスタイリング - UIモジュール (
core:ui): 再利用可能なコンポーネントとユーティリティDebouncedClickable- ダブルクリック防止- 画面とコンポーネント用のプレビューアノテーション
効率的なUI開発のための2種類のプレビューアノテーション:
PreviewScreen - 画面レベルのComposable用(8パターン)
- ライト/ダークテーマ × スマホ/タブレット × 標準/大フォント
- システムUIとデバイスフレームを表示
- レスポンシブデザインとアクセシビリティを確保
PreviewComponent - コンポーネントレベルのComposable用(4パターン)
- ライト/ダークテーマ × 標準/大フォント
- デバイスフレームなしの素早いプレビュー
- コンポーネントの動作に焦点
- Kotlin: 2.2.21
- Gradle: 8.13(バージョンカタログ使用)
- Android Gradle Plugin: 8.12.3
- Compose BOM: 2025.10.01
- Min SDK: 29(Android 10)
- Target SDK: 36
- 依存性注入: Koin 4.1.1
- ナビゲーション: Navigation Compose 2.9.5
- シリアライゼーション: Kotlinx Serialization 1.9.0
- コード品質: Detekt 1.23.8(Composeルール含む)
GitHubでこのテンプレートから新しいリポジトリを作成:
- このリポジトリの上部にある "Use this template" ボタンをクリック
- "Create a new repository" を選択
- リポジトリ名と設定を入力
- "Create repository" をクリック
- 新しいリポジトリをローカルにクローン:
git clone git@github.com:YOUR_USERNAME/YOUR_REPO_NAME.git cd YOUR_REPO_NAME
変換スクリプトを実行してテンプレートをカスタマイズ:
chmod +x scripts/convert-project.sh
./scripts/convert-project.shスクリプトは以下を対話的に入力させます:
- パッケージ名(例:
com.example.myapp) - プロジェクト名(例:
my-app) - Convention plugin ID(例:
myapp) - テーマ名(例:
MyApp) - Applicationクラス名(例:
MyAppApplication)
Android Studioでプロジェクトを開き、Gradleを同期:
./gradlew clean buildモジュール作成スクリプトで新しいモジュールを作成:
chmod +x scripts/create-module.sh
./scripts/create-module.shandroid-template/
├── app/ # メインアプリケーションモジュール
├── core/
│ ├── designsystem/ # テーマ、カラー、タイポグラフィ
│ └── ui/ # 再利用可能なUIコンポーネントとプレビュー
├── build-logic/ # Convention plugins
│ └── convention/ # Gradle convention plugins
├── config/ # 設定ファイル(Detekt)
├── scripts/ # 自動化スクリプト
├── .github/workflows/ # CI/CDワークフロー
└── gradle/ # Gradleラッパーとバージョンカタログ
一貫したモジュール設定のためのカスタムGradleプラグイン:
| プラグイン | 用途 | 使用場所 |
|---|---|---|
androidtemplate.android.application |
アプリモジュール設定 | メインアプリケーション |
androidtemplate.android.library |
基本ライブラリモジュール | データ、ドメイン層 |
androidtemplate.android.library.compose |
Composeライブラリモジュール | Compose使用のUIライブラリ |
androidtemplate.android.feature |
フィーチャーモジュール設定 | 機能モジュール |
androidtemplate.detekt |
静的解析 | コード品質チェック |
カスタム名でテンプレートをプロジェクトに変換します。新規プロジェクト開始時に1回だけ実行します。
./scripts/convert-project.sh適切なパッケージ構造で新しいモジュールを対話的に作成します。
./scripts/create-module.shオプション:
- Coreライブラリ(Compose有/無)
- Featureモジュール
- カスタムパス
2つのGitHub Actionsワークフローが含まれています:
-
テストワークフロー (
.github/workflows/test.yml) - PR/push時に実行- カバレッジ付きユニットテスト
- テストレポートをアーティファクトとしてアップロード
-
Detektワークフロー (
.github/workflows/detekt.yml) - 静的解析- コード品質チェック
- Compose固有のルール
-
フィーチャーモジュールを作成:
./scripts/create-module.sh
「Feature Module」オプションを選択。
-
モジュールの
build.gradle.ktsに依存関係を追加
一元管理のためgradle/libs.versions.tomlを編集:
[versions]
mylib = "1.0.0"
[libraries]
mylib = { group = "com.example", name = "mylib", version.ref = "mylib" }モジュールで使用:
dependencies {
implementation(libs.mylib)
}コミット前にDetektを実行:
./gradlew detektコントリビューションを歓迎します!IssueやPull Requestをお気軽に提出してください。
- Scripts Documentation - Detailed script usage
- Workflows Documentation - CI/CD setup