Modularization - Lessons learned

Great article!

One of the most intriguing ways Gradle accomplishes this is by being smart about whether a code change will also require other modules to be recompiled. While you can find the full explanation here, it suffices to say here that you should always strive to implementation dependencies instead of api.

To best utilize this, modules' dependency tree should be of less height. Because if height is higher, like a -> b -> c -> d -> e and e changes, it will have cascade effect till a even if implementation is used. However it the tree height is close to flat, greater build speed improvements can be seen as per change less modules need recompilation due to Gradle's compile avoidance feature.

I think there is a proposal in Gradle to address this by detecting if line change is affecting public API so that Gradle can detect if higher up dependencies should be recompiled. (please correct me if I got this wrong)

/r/androiddev Thread Link - jeroenmols.com