Exclude specific build variants

后端 未结 9 896
一向
一向 2020-12-07 11:07

I have the two default build types: debug / release and a couple of flavors: prod / dev.

Now I want to exclude the build variant dev-release, but keep all other poss

9条回答
  •  温柔的废话
    2020-12-07 11:27

    The answer of @ade.se didn't work for me. But I've struggled a little, and written this, that works great:

    android {
    compileSdkVersion 22
    buildToolsVersion '20.0.0'
    
    variantFilter { variant ->
        if (variant.buildType.name.equals('debug') || variant.buildType.name.equals('release')) {
            variant.setIgnore(true);
        }
    }
    
    defaultConfig {
        applicationId "com.fewlaps.quitnow"
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 35
        versionName "1.35"
    }
    

    The code you have to add is the variantFilter one, but I've pasted a little of the context to make it easy to understand.

提交回复
热议问题