How can I provide a "fakes" product flavor without also specifying a "real" (default) product flavor?

79 views Asked by At

I want to provide a build variant for fake implementation of interfaces provided by a module. I can use productFlavors to achieve this

android {
  flavorDimensions "realOrFake"

  productFlavors {
      fakes {...}
      real {...}
  }
}

This generates 4 build variants

  • fakesDebug
  • fakesRelease
  • realAssemble
  • realRelease

However I want to provide the default configuration, and an optional fakes configuration (I don't want to define a real product flavor. So the 4 build variants should be:

  • fakesDebug
  • fakesRelease
  • debug
  • release

Is this possible? Or do I have to provide the real product flavor and utilize matchingFallbacks? I want to avoid every downstream module having to specify the real flavor. I'd always want compile to use an upstream's real product flavor, and testCompile to always use the upstream's fakes product flavor.

Note: using Android Gradle Plugin 3.0

0

There are 0 answers