What i want : I want to have some class say Example, which used in the main project, be a complete NO-OP when being built with any <build type><flavor> other then <build type>example, only when built with <build type>example flavors, it should have code that really does stuff.
What i tried:
I added an Example flavor to gradle:
flavorDimensions "example"
productFlavors {
create("example") {
dimension = "example"
}
}
Added source to the coresponding source set:
src->example->com.example->Example.java
Now i am stuck with how to add a NO-OP Example.java so that it will be used for any OTHER flavor. tried to add to
src->main->com.example->Example.java
But its considered redeclaration (since main is shared between all flavors). So how can it be done?
NOTE: the user of Example class should not care or be aware of weither Example class methods are complete NO-OPs or not, I want him to be able to have same minimal (without annoying if checks) source code be built succesfully with NO-OPs methods in <build type>example builds, and with real code in <build type><any flavor other then example> builds.