mlevytskiy
mlevytskiy

Reputation: 1665

How to use multiple flavors in gradle with kotlin-dsl?

It is in android gradle build scripts. I have multiple flavors in gradle:

flavorDimensions "brand", "appVariant"
productFlavors {
    stage {
        dimension "appVariant"
    }
    prod {
        dimension "appVariant"
    }
    brand1 {
        dimension "brand"
    }
    brand2 {
        dimension "brand"
    }
}

How can I rewrite that using kotlin-dsl?

Upvotes: 2

Views: 902

Answers (1)

Vlad M.
Vlad M.

Reputation: 46

This will work:

flavorDimensions("brand", "appVariant")
productFlavors {
    create("var1") {
        setDimension("appVariant")
    }

    create("var2") {
        setDimension("appVariant")
    }

    create("brand1") {
        setDimension("brand")
    }

    create("brand2") {
        setDimension("brand")
    }
}

Upvotes: 3

Related Questions