Modularization Interview Questions

BUILD & TOOLING › Gradle

Why would you modularise an Android app?

What a strong answer covers: Faster builds (Gradle only rebuilds changed modules and can build in parallel), clear ownership and boundaries between teams, enforced separation of concerns because modules can't reach each other's internals, reuse, isolated testing, and dynamic feature delivery. The costs are build configuration, more boilerplate and the need for good dependency rules.

What kinds of modules would you create, and how do they depend on each other?

What a strong answer covers: A common setup: app (wires everything), feature modules (feature:home, feature:profile) that don't depend on each other, core modules (core:data, core:network, core:database, core:designsystem, core:testing), sometimes split into api and impl. Dependencies point from app to features to core, never sideways between features.

How do you handle navigation between feature modules without making them depend on each other?

What a strong answer covers: Each feature exposes its routes and a NavGraphBuilder extension in a small api module, or the app module passes navigation callbacks into feature entry points. Features depend only on route types or interfaces, never on another feature's implementation. The app module builds the NavHost and connects them. Deep links can also be the contract.

What are convention plugins, and why use them in a multi-module project?

What a strong answer covers: Convention plugins live in an included build (build-logic) and contain shared Gradle configuration, like android-library, compose or hilt setup, applied with one plugin id. They replace copy-pasted build files and subprojects { } blocks, keep modules consistent, and are configuration-cache friendly. Now in Android is the common reference.

How do you modularise an existing monolithic app without stopping feature work, and how do you know it's working?

What a strong answer covers: Start by extracting stable foundations (design system, networking, models, utilities) into core modules, then extract one feature at a time, starting with the least entangled. Introduce interfaces where features reach into each other, and move DI setup per module. Enforce boundaries with dependency rules or lint. Measure success with incremental build times, module graph health, how often changes touch many modules, and team velocity.

Back to Modularization