Structure an Android app that stays testable and maintainable as it grows. MVVM with a ViewModel holding UI state, the repository pattern as the single source of truth, dependency injection with Hilt, local persistence with Room and DataStore, networking with Retrofit, and testing the whole stack.
Before you start
This is the layer that ties everything together — take the Kotlin, Android Development, and Jetpack Compose courses first.
MVVM & the ViewModel
Separate what the screen shows from how it looks. The ViewModel holds UI state and survives rotation; the UI observes it and sends events. Learn MVVM and unidirectional data flow with StateFlow.
The Repository Pattern
A ViewModel should not know whether data comes from the network or a database. The repository is a single source of truth that hides data sources behind a clean API — the seam that makes apps testable.
Dependency Injection with Hilt
A ViewModel needs a repository, which needs an API and a database. Dependency injection wires this graph for you instead of constructing it by hand. Learn DI and Hilt, the standard on Android.
Local Storage: Room & DataStore
Persist data on the device: Room gives you a typed SQLite database with reactive queries, and DataStore stores key-value preferences safely. Plus where SharedPreferences fits (and why to move on).
Networking with Retrofit
Almost every app talks to a backend. Retrofit turns an annotated Kotlin interface into a type-safe HTTP client, integrates with coroutines, and — with OkHttp underneath — handles serialization, errors, and logging.
Testing Android Apps
The architecture in this course exists to be testable. Write fast unit tests for ViewModels and repositories with JUnit and fakes, test coroutines and Flows, and verify UI with Compose UI tests.