How awasisto/android-clean-architecture-samples works
Project Type and Purpose
• This is a multi-module Android sample project demonstrating Clean Architecture.
• It provides four variants (MVP in Java/Kotlin and MVVM in Java/Kotlin), each structured into four Gradle modules:
• common – shared utilities (e.g., Logger)
• data – Android-specific data layer (Retrofit, SQLite)
• domain – business rules, use cases, models, interfaces
• ui – presentation layer (Activities, Presenters/ViewModels, Views)
• The sample app lets users search GitHub users and view search history.
File Structure Analysis
• Top-level modules: mvp-java, mvp-kotlin, mvvm-java, mvvm-kotlin.
• Within each sample module:
• common – contains cross-cutting code (Logger).
• data – implements domain interfaces:
– github remote (GithubService + RetrofitGithubDataSource)
– local history (SQLite via SearchHistoryDbHelper + SqliteSearchHistoryDataSource)
– AndroidLogger
• domain – pure Java/Kotlin with interfaces (GithubDataSource, SearchHistoryDataSource), entities (User, SearchUsersResult, SearchHistoryItem), and use cases (SearchUsersUseCase, GetUserUseCase, GetSearchHistoryUseCase).
• ui – Android project:
– ServiceLocator/DefaultServiceLocator to wire dependencies
– Presentation (Activity + Presenter or Activity + ViewModel)
– Adapters for RecyclerView, Views, layouts
README Insights
• Emphasis on separation of concerns: UI layer knows only about domain use cases; domain layer is independent of frameworks; data layer bridges domain interfaces to Android/Retrofit/SQLite.
Essential Architectural Elements to Capture
• Dependency flow: UI → Domain Interfaces ← Data Implementations
• Two data sources: remote (GitHub API) and local (SQLite)
• Use cases as the entry point to business logic
• Service Locator / Composition root in UI module
• Shared utilities in common module