Ankit
Ankit

Reputation: 6622

how to build different variants of android through gradle

I already have

2 flavours (staging, production)

2 buildTypes (debug, release)

beyond that, I want to have different variants for, say, different vendors. like a production-release build for samsung and htc. is it possible through build scripts?

PS: I don't want to use 3rd party plugin like this

Upvotes: 3

Views: 313

Answers (1)

Mark Vieira
Mark Vieira

Reputation: 13466

You could use flavor dimensions.

android {
    flavorDimensions 'environment', 'vendor'

    productFlavors {
        staging {
            flavorDimension 'environment'
        }

        production {
            flavorDimension 'environment'
        }

        htc {
            flavorDimension 'vendor'
        }

        samsung {
            flavorDimension 'vendor'
        }
    }
}

Upvotes: 3

Related Questions