Roberto Pelonara
Roberto Pelonara

Reputation: 21

How to build with a default flavor dimension?

Having these flavors defined:

flavorDimensions "env", "type"

    productFlavors {
        new{
            dimension "type"
            ...
        }
        legacy{
            dimension "type"
            ...
        }
        staging {
            dimension "env"
            ...
        }
        prod {
            dimension "env"
            ...
        }

Is it possible in some way ask gradle to "assembleStaging" assuming that the default "type" dimension is "legacy"?

Upvotes: 1

Views: 698

Answers (1)

Rahul Mishra
Rahul Mishra

Reputation: 1559

I faced the same issue and I resolved it by using like this

flavorDimensions "type"

productFlavors {
    new{
        dimension "type"
        ...
    }
    legacy{
        dimension "type"
        ...
    }
    staging {
        dimension "type"
        ...
    }
    prod {
        dimension "type"
        ...
    }

You have to pass same dimension for each flavors.

When you write code in your main directory it'll common for all your flavors, you can write flavors related code in flavors directory. For creating specific flavors debug build you can change it from Build Variants option at left bottom corner, for creating release build their is option appears for target flavors after entering your jks signing related details.

Upvotes: 2

Related Questions