How to add dependency for two build types with one configuration?

Viewed 14

My app consists of 2 flavors and 3 build types:

productFlavors {
    free
    paid
}

buildTypes {
    debug
    beta
    release
}

I can simply add a dependency for all variants, specific flavor or build type:

dependencies {
    implementation "some-dependency"
    freeImplementation "some-dependency"
    betaImplementation "some-dependency"
}

To add a dependency for a specific variant, I can do do this:

configurations {
    freeDebugImplementation
}

dependencies {
    freeDebugImplementation "some-dependency"
}

But what I want is to combine several flavors/build types/variants. Something along the lines of:

configurations {
    debugBetaImplementation
}

dependencies {
    debugBetaImplementation "some-dependency"
}

which should be equivalent to:

dependencies {
    debugImplementation "some-dependency"
    betaImplementation "some-dependency"
}

Is there a way to achieve this?

0 Answers
Related