Posts on Medium Pavan Varma Nov 24, 2025

Core/Core-Impl Pattern: Build-Performance Superpower of DI & Gradle

M2 Related OWASP risk: Inadequate Supply Chain Security Learn more →

Article Summary

Your modular Android app is building like a monolith. One shared :core module is killing your build times, even when you change a single private implementation detail.

Pavan Varma breaks down the Core/Core-Impl pattern for Android projects. This architectural approach uses dependency injection to separate interface contracts from heavy implementations, unlocking true parallel compilation in Gradle.

Key Takeaways

Critical Insight

By separating what features need (interfaces) from how it's implemented, teams achieve dramatic build speed improvements without throwing hardware at the problem.

The article includes specific Gradle commands to measure if your project actually needs this refactor before you start.

About This Article

Problem

Every time :core changed, feature modules had to recompile even if only private implementation details were affected. This happened because all features depended on one shared module that mixed interfaces, implementations, and third-party libraries together.

Solution

Pavan Varma's Core/Core-Impl pattern splits the shared module into two parts. :core contains just interfaces and data models with few dependencies. :core-impl holds the heavy implementations like Retrofit and Room. Feature modules only depend on :core through Hilt dependency injection.

Impact

Gradle can now compile feature modules and :core-impl in parallel since they don't depend on each other. Compilation avoidance also kicks in because changes to :core-impl don't affect :core's public ABI, so feature modules don't need to recompile unnecessarily.