Have a product flavor be a child of another

后端 未结 3 1273
灰色年华
灰色年华 2021-02-02 15:49

I\'m setting up the product flavors in my app and have run into one problem. Two of my product flavors are very similar to each other and only differ by a few resources, let\'s

3条回答
  •  感动是毒
    2021-02-02 16:23

    I was looking for a similar thing in gradle and found Multi-flavor variants. I have an app that should have versions A and B, and each version has dev and pro environments, so I ended up with this in my gradle:

    flavorDimensions 'app', 'environment'
    
    productFlavors {
        versionA {
            flavorDimension 'app'
        }
        versionB {
            flavorDimension 'app'
        }
        pre {
            flavorDimension 'environment'
        }
        pro {
            flavorDimension 'environment'
        }
    }
    

    And in my build variants I have versionAPreDebug, versionAPreRelease, versionBPreDebug, versionBPreRelease, etc. I think what you need is something like that.

提交回复
热议问题