gpt4 book ai didi

android - 唯一的buildConfigField,适用于所有带有尺寸的样式

转载 作者:行者123 更新时间:2023-12-03 03:46:27 25 4
gpt4 key购买 nike

我有两个 flavor 维度:brandversion,我的 flavor 配置如下:

flavorDimensions 'brand', 'version'

Brand1 {
dimension 'brand'
...
}

Brand2 {
dimension 'brand'
...
}

Version1 {
dimension 'version'
...
}

Version2 {
dimension 'version'
...
}

我想要每种配置都有四个唯一的 buildConfigField -s(例如HockeyAppId):
  • Brand1Version1
  • Brand1Version2
  • Brand2Version1
  • Brand2Version2

  • 我该怎么做?

    最佳答案

    为此,我编写了自己的插件https://github.com/nikialeksey/porflavor,现在可以定义以下字段:

    flavorDimensions 'brand', 'version'

    productFlavors {
    Brand1 {
    dimension 'brand'
    ...
    }
    Brand2 {
    dimension 'brand'
    ...
    }

    Version1 {
    dimension 'version'
    ...
    }
    Version2 {
    dimension 'version'
    ...
    }
    }

    apply plugin: 'com.nikialeksey.porflavor'
    porflavor {
    Brand1Version1 {
    buildConfigField "boolean", "fooFeatureEnabled", "false"
    }
    Brand2Version2 {
    buildConfigField "boolean", "fooFeatureEnabled", "true"
    }
    ...
    }

    关于android - 唯一的buildConfigField,适用于所有带有尺寸的样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56043460/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com