小编Nig*_*len的帖子

Android Specific Gradle产品风味组合

在我的代码中,我有一些模板都来自一个代码库.对于每个模板,我想添加特定尺寸.使用风味尺寸和产品口味我已经达到了这个代码:

flavorDimensions "template", "color"

productFlavors {

    templateA {
        applicationId "com.templatea"
        versionCode 1
        versionName "1.0.0"

        flavorDimension "template"
    }


    templateB {
        applicationId "com.templateb"
        versionCode 1
        versionName "1.0.0"

        flavorDimension "template"
    }

    templateC {
        applicationId "com.templatec"
        versionCode 1
        versionName "1.0.0"

        flavorDimension "template"

    }

    blue {
        applicationId "com.blue"
        versionCode 1
        versionName "1.0.0"

        flavorDimension "color"
    }

    green {
        applicationId "com.green"
        versionCode 1
        versionName "1.0.0"

        flavorDimension "color"
    }

    orange {
        applicationId "com.orange"
        versionCode 1
        versionName "1.0.0"

        flavorDimension "color"
    }    
Run Code Online (Sandbox Code Playgroud)

这给出了结果(我忽略了buildtypes):

templateABlue

templateAGreen

templateAOrange

templateBBlue templateBGreen

templateBOrange templateCBlue …

android gradle

9
推荐指数
1
解决办法
904
查看次数

标签 统计

android ×1

gradle ×1