How would you modularize a large Android app, and how do you keep builds fast?
AndroidSenior
In shortSplit into :app, :feature:* and :core:* Gradle modules with dependencies pointing down only, use implementation over api, keep versions in a version catalog and shared setup in convention plugins, and speed builds with KSP, the configuration and build caches, and a wide graph.
Model answer
Graph: :app (thin: application class, navigation wiring) → :feature:* (screens and view models, owned by teams) → :core:* (model, data, network, database, designsystem, testing). Features never depend on each other; :app connects them through navigation, or features expose tiny :api modules with route types. A CI check fails on forbidden edges.
Dependencies: implementation by default, so dependencies stay off consumers’ compile classpaths and changes don’t cascade; api only for types in a module’s public signatures (a repository returning model types). Domain code in pure Kotlin/JVM modules builds faster and stays Android-free. Hilt bindings from any module are aggregated in :app.
Gradle setup: a version catalog (libs.versions.toml) for every library and plugin; convention plugins in an included build-logic build (shop.android.feature, shop.android.library) so module build files are a few lines; KSP instead of kapt; non-transitive R classes.
Speed: configuration cache (no side effects at configuration time; use providers), local and remote build cache, parallel execution; measure with Build Analyzer and build scans, tracking the incremental build time for a typical change.
Migration: quick wins first (KSP, caches, catalog, convention plugins), then core modules, then features by team, measuring after each step.
What they're looking for
A clear module graph and rules, implementation vs api with the recompilation reasoning, version catalogs and convention plugins, build performance tools, and an incremental migration with metrics.
Common mistakes
- Splitting by technical layer only (one big :ui, one big :data).
- Using api everywhere.
- Putting shared build logic in buildSrc or subprojects blocks.
More android questions
- How do you make sure background work in a mobile app stops when the user leaves the screen?Mid-level
- What's the difference between a configuration change and process death on Android, and what survives each?Mid-level
- How do you store an auth token securely on Android?Mid-level
- What are the main security risks of exported components, intents and WebViews on Android?Senior