A modern, production-ready Android starter project built with MVVM architecture, Jetpack Compose, and Hilt dependency injection. This boilerplate provides a solid foundation for building scalable Android applications with best practices.
- 🏗️ Clean Architecture - MVVM pattern with clear separation of concerns
- 🎨 Modern UI - Jetpack Compose with Material 3 design system
- 💉 Dependency Injection - Hilt for clean dependency management
- 🌐 Networking Ready - Retrofit + OkHttp + Moshi setup
- 🧭 Navigation - Compose Navigation with type-safe routing
- 🎯 State Management - ViewModels with StateFlow
- 🔧 Build Tools - Gradle with Kotlin DSL and Spotless formatting
- 📱 Modern Android - Target SDK 34, minimum SDK 21
┌─────────────────────────────────────────────────────────────┐
│ Presentation Layer │
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────┐ │
│ │ MainActivity │ │ WelcomeScreen │ │ EmptyScreen │ │
│ └─────────────────┘ └─────────────────┘ └─────────────┘ │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ ViewModel Layer │
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ MainViewModel │ │
│ │ (State Management) │ │
│ └─────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ Domain Layer │
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ Repository Interfaces │ │
│ │ (Business Logic) │ │
│ └─────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ Data Layer │
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────┐ │
│ │ ApiService │ │ Repository │ │ Data Models │ │
│ │ (Retrofit) │ │ Implementation │ │ │ │
│ └─────────────────┘ └─────────────────┘ └─────────────┘ │
└─────────────────────────────────────────────────────────────┘
| Component | Technology | Version |
|---|---|---|
| Language | Kotlin | 1.9.0 |
| UI Framework | Jetpack Compose | 1.6.8 |
| Architecture | MVVM + Clean Architecture | - |
| Dependency Injection | Hilt | 2.47 |
| Networking | Retrofit + OkHttp + Moshi | 2.9.0 / 4.12.0 / 1.15.0 |
| Navigation | Compose Navigation | 2.7.7 |
| State Management | ViewModel + StateFlow | - |
| Build System | Gradle + Kotlin DSL | 8.5.1 |
| Code Quality | Spotless + KTLint | 6.25.0 |
app/
├── src/main/
│ ├── java/malcolm/android/dev/newemptycomposeapp/
│ │ ├── data/ # Data layer
│ │ │ ├── api/ # API interfaces
│ │ │ ├── repository/ # Repository implementations
│ │ │ └── util/ # Utility classes
│ │ ├── di/ # Dependency injection
│ │ │ ├── AppModule.kt # App-level dependencies
│ │ │ └── NetworkModule.kt # Networking dependencies
│ │ ├── ui/ # UI layer
│ │ │ ├── screens/ # Compose screens
│ │ │ │ ├── WelcomeScreen.kt # Welcome screen
│ │ │ │ └── EmptyScreen.kt # Empty screen
│ │ │ ├── theme/ # UI theming
│ │ │ ├── MainActivity.kt # Main activity
│ │ │ └── MainViewModel.kt # Main view model
│ │ └── navigation/ # Navigation
│ │ ├── NavGraph.kt # Route definitions
│ │ └── AppNavigation.kt # Navigation setup
│ └── res/ # Resources
├── build.gradle.kts # App-level build config
└── AndroidManifest.xml # App manifest
gradle/
└── libs.versions.toml # Version catalog
build.gradle.kts # Project-level build config
settings.gradle.kts # Project settings
gradle.properties # Gradle properties
- Android Studio Arctic Fox (2020.3.1) or later
- JDK 17 or later
- Android SDK API level 21 (Android 5.0) or higher
- Gradle 8.5.1 or later
-
Clone the repository
git clone https://github.com/malcolmmaima/My-Android.git cd My-Android -
Open in Android Studio
- Launch Android Studio
- Select "Open an existing project"
- Navigate to the cloned directory and select it
-
Sync and Build
- Wait for Gradle sync to complete
- Build the project:
Build → Make Project - Run on device/emulator:
Run → Run 'app'
The app will launch with:
- Welcome Screen - Displays a greeting and navigation button
- Navigation - Tap the button to navigate to an empty screen
- Back Navigation - Use the back button or "Go Back" button
-
Update Package Name
// In app/build.gradle.kts namespace = "your.package.name" // In AndroidManifest.xml package="your.package.name"
-
Change App Name
<!-- In res/values/strings.xml --> <string name="app_name">Your App Name</string>
-
Update API Base URL
// In di/NetworkModule.kt .baseUrl("https://your-api-domain.com/")
-
Create Screen Composable
@Composable fun NewScreen() { // Your screen content }
-
Add Route to NavGraph
sealed class Screen(val route: String) { object NewScreen : Screen("new_screen") }
-
Add to Navigation
composable(Screen.NewScreen.route) { NewScreen() }
The project comes with a complete networking setup ready for your API:
- Retrofit - HTTP client for API calls
- OkHttp - HTTP client with logging
- Moshi - JSON parsing library
- Hilt Integration - Dependency injection for networking
- Update ApiService.kt with your endpoints
- Create data models for your API responses
- Implement repository methods for data operations
- Add ViewModel logic for state management
- Material 3 design system
- Dynamic colors support (Android 12+)
- Dark/Light themes with automatic switching
- Custom color schemes in
ui/theme/Color.kt
- Create reusable composables in
ui/components/ - Follow Material 3 design guidelines
- Use the existing theme system for consistency
./gradlew assembleDebug./gradlew assembleRelease# Format code
./gradlew spotlessApply
# Check formatting
./gradlew spotlessCheck- Place test files in
src/test/ - Use JUnit 4 or 5
- Test ViewModels, Repositories, and Use Cases
- Place test files in
src/androidTest/ - Use Compose Testing library
- Test screen navigation and interactions
- Model - Data and business logic
- View - UI components (Compose screens)
- ViewModel - State management and business logic
- StateFlow - Reactive state streams
- ViewModel - Lifecycle-aware state holder
- Unidirectional Data Flow - UI → ViewModel → Repository
- Hilt - Android DI framework
- Modules - Dependency providers
- Scopes - Lifecycle management
-
Build Fails with KTLint Errors
- KTLint is disabled in this project for flexibility
- Code formatting is handled by Spotless
-
Gradle Sync Issues
- Check internet connection
- Clear Gradle cache:
./gradlew clean - Invalidate caches in Android Studio
-
Navigation Issues
- Ensure routes are properly defined in
NavGraph.kt - Check that screens are added to
AppNavigation.kt
- Ensure routes are properly defined in
- Use
rememberandderivedStateOffor expensive computations - Implement proper state hoisting
- Use
LaunchedEffectfor side effects - Avoid unnecessary recompositions
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
- Google - For Jetpack Compose and Android architecture components
- Android Community - For best practices and guidance
- Open Source Contributors - For the libraries that make this possible
- Issues - Create an issue on GitHub
- Discussions - Use GitHub Discussions for questions
- Documentation - Check the Android Developer Docs
Happy Coding! 🎉
Built with ❤️ using modern Android development practices.