简体   繁体   中英

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

You could use flavor dimensions.

android {
    flavorDimensions 'environment', 'vendor'

    productFlavors {
        staging {
            flavorDimension 'environment'
        }

        production {
            flavorDimension 'environment'
        }

        htc {
            flavorDimension 'vendor'
        }

        samsung {
            flavorDimension 'vendor'
        }
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM