This repository serves as a starter template for Android projects with pre-configured tools and best practices. It provides a solid foundation for building scalable and maintainable Android applications.
This project includes the following essential dependencies:
- Dependency Injection: Hilt - Simplified dependency injection.
- Networking: Ktor - HTTP client for Android with serialization and logging support.
- Coroutines: Kotlin Coroutines - Simplified asynchronous programming.
- Database: Room - SQLite database with type-safe access.
- **Paging **: Paging 3 - Efficient data pagination for large data sets.
dependencies {
// Hilt
implementation(libs.hilt.android)
kapt(libs.hilt.compiler)
// Ktor
implementation(libs.ktor.client.android)
implementation(libs.ktor.client.logging)
implementation(libs.ktor.client.serialization)
implementation(libs.ktor.client.json)
// Coroutines
implementation(libs.kotlinx.coroutines.android)
// Room
implementation(libs.androidx.room.runtime)
kapt(libs.androidx.room.compiler)
implementation(libs.androidx.room.ktx)
// Paging
implementation(libs.androidx.paging.runtime.ktx)
}
The project includes the following tools for static analysis and build validation:
- Detekt: Kotlin static code analysis for code smells.
- Spotless: Ensures consistent code formatting with Ktlint.
- Dependency Guard: Tracks changes in project dependencies.
- Unit Testing: JUnit and Roborazzi for screenshot testing.
- Lint: Analyzes and suggests fixes for Android-specific issues.
- Build: Ensures the application compiles correctly.
# Detekt
./gradlew detekt
# Spotless
./gradlew spotlessApply
# Dependency Guard
./gradlew dependencyGuard
./gradlew dependencyGuardBaseline
# Unit Tests
./gradlew testDebugUnitTest
# Lint
./gradlew lint
# Build APK
./gradlew assembleDebug
The project follows a layered MVVM architecture with clear separation of concerns:
-
UI Layer:
- Contains
Activity
andCompose
components for user interface. - Uses
ViewModel
to handle UI state and logic.
- Contains
-
Domain Layer:
- Business logic and use case handling.
- Independent of UI and data layers.
-
Data Layer:
- Responsible for managing data from local (Room) and remote (Ktor) sources.
- Implements repositories for data abstraction.
app/
├── data/
│ ├── repository/
│ ├── local/
│ └── remote/
├── domain/
│ ├── model/
│ └── usecase/
├── ui/
│ ├── components/
│ ├── screens/
│ └── viewmodel/
- Android Studio: Latest stable version.
- JDK 11: Compatible with the project's Gradle configuration.
- Clone this repository:
git clone https://github.com/your-repo/android-todo-starter.git
- Open the project in Android Studio.
- Sync Gradle and resolve dependencies.
- Run the following command to verify the setup:
./gradlew build
- Start developing!
This project is licensed under the MIT License. See the LICENSE file for details.