My single-module app has become very code-heavy and debugging has become a pain. Since I work on a small part of app at a time, most features are useless during debug, and I decided to split my app into modules.
The goal is to have a lightweight 'app' module and multiple 'feature-N' modules. In my 'settings.gradle' I want to enable only the 'app' and feature module I am working on, ignoring the rest until I go for a release build.
So I came up with one interface per feature. The question is where to put them.
- If I put the interfaces in individual modules, then 'app' module will have references to all 'feature' modules; and so disabling any module in 'settings.gradle' will break compilation. Only workaround seems to be commenting out code for unused interfaces, which is not feasible in a large project as the code is scattered.
- If I put the interfaces in the 'app' module, the implementations would be in the 'feature' modules and I can add runtime checks to prevent crashes. This is what I want. But now the dependencies are inverted - 'feature' module would depend on 'app' module; and gradle won't allow that.
- One alternative solution to this is by forcibly disabling the assemble tasks for all unused feature modules, which helps me with faster builds; but since my APK size is big, it still takes 20 seconds to upload to a device.
I have tried pretty much all the gradle tricks to speed up my builds with no major improvements, so I am hoping to get answer to my original query.