A robust, modern Android application built using native development best practices to demonstrate clean architecture, reactive UI state management, and dependency injection. The application fetches a list of products from a remote API and presents them cleanly to the user.
The application follows the MVVM (Model-View-ViewModel) design pattern coupled with Clean Architecture principles to establish separation of concerns, scalability, and ease of testing.
- UI Layer: Native Android components utilizing
FragmentsandRecyclerViewpowered by ViewBinding for type-safe layout interaction. - Asynchronous Logic: Powered by Kotlin Coroutines and structured concurrency to perform non-blocking background operations.
- State Management: StateFlow handles single-source-of-truth UI state propagation reactively to the view layer.
- Dependency Injection: Hilt (Dagger) handles project-wide dependency injection, scoping network and repository objects optimally.
- Network Layer: Retrofit combined with OkHttp handles remote API communication with active logging interceptors.
com.example.productassessment
│
├── data/
│ ├── remote/
│ │ ├── api/ # Retrofit endpoints (ProductApi)
│ │ └── model/ # Remote data transfer models (Product)
│ └── repository/ # Data operations layer (ProductRepository)
│
├── di/ # Hilt Dependency Injection modules (HiltNetworkModule)
│
└── ui/
└── productList/ # Presentation UI layer (Fragment, ViewModel, Adapter, UiStates)
- AGP 9.0 Built-in Kotlin Integration: Migrated build scripts to match modern Android Gradle Plugin 9.4.0+ specifications where Kotlin compilation support is automatically bundled inside the application plugin.
- KSP & SourceSet Adaptation: Configured
android.disallowKotlinSourceSets=falseinside the project properties to allow the Kotlin Symbol Processing (KSP) engine to safely compile code side-by-side with the modern built-in Kotlin compiler. - Robust Lifecycle Observers: Implemented
viewLifecycleOwner.repeatOnLifecycle(Lifecycle.State.STARTED)inside the UI layer to safely collect state emissions only when the UI is explicitly in the foreground, eliminating potential memory leaks.
- Android Studio: Android Studio Ladybug (2026.1.4) or newer.
- JDK: Version 11 or higher.
- API Constraints: Minimum SDK 24, Target SDK 37.
- Clone or open the repository in Android Studio.
- Let Gradle build and synchronize successfully.
- Deploy onto a running Emulator or Physical device with an active network connection.