Skip to content
Commitwise
Menu

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

Esc

Type to search the whole site.