android - Gradle: Multi-Dimension Flavor ApplicationId -
I have a relatively complex project that requires two taste dimensions for each app. {Green flavorDimension "color"} {green flavorDimension "color"} {green flavorDimension: I think it's more just again in the example given below: Write "color"} class {flavorDimension "size"} circle {flavorDimension "size"}
I want to be able to install a different applicationId for each type, like : The squareblue is a different application for the circle. I can not set the application in the color dimension because it is in the shape of each size To be similar. In the above example, I will need 6 different application IDs. These IDs do not follow any pattern, they can be anything.
I have seen the answer here: but this would mean that I have to set it manually, which is not possible for my project, because of the number of 1000s (1000s).
What I really want to do is, two dimensions are set on the color dimension, then it makes right on the dimensions of size, when it is created, I define the variable Have tried, but there is no success in it, they are finally overwritten.
I have found the following solution from this example:
If you add a grade to your grade so you can add custom attributes for the product.
productFlavors.whenObjectAdded {tastes -> Inside your product tastes, you can set the value of each shape type. blue {flavorDimension "color" platformIds.squareId "yourAppId" platformIds.circleId "yourAppId"}
>
Def applicationId = "" def flavors = variant.getFlavors () if (flavors [0] .name.equals ("square")) {applicationId = flavors [1] .platformIds.squareId} else if (flavors [0] .name .equals ("circle")) {applicationId = flavors [1] .platformIds.circleId} variant.getDefaultConfig (). ApplicationId applicationId}
This may not be the most elegant or efficient way to achieve it, but it is working perfectly for me. Now I can add all my IDs to the productPlayer In the section and then the variant filter sets the correct application ID based on the first taste.
Comments
Post a Comment