我需要构建一个用风味创建的应用程序,并创建一个动态变量,该动态变量指向另一种风味的 applicationId (因为内部库的代码使用了其他应用程序的applicationId),但我不知道该怎么做。
这是示例代码:
defaultConfig {
applicationId "com.sample.mycompany"
}
buildTypes {
release {
}
qualif {
applicationIdSuffix = ".qual"
}
debug {
applicationIdSuffix = ".dev"
}
}
flavorDimensions "client", "nature"
productFlavors {
ClientA {
dimension "client"
applicationIdSuffix = ".A"
}
ClientB {
dimension "client"
applicationIdSuffix = ".B"
}
NatureX {
dimension "nature"
applicationIdSuffix = ".X"
}
NatureY {
dimension "nature"
applicationIdSuffix = ".Y"
// A buildconfigField variable here to get com.sample.mycompany[client].X[buildTypes]
}
NatureZ {
dimension "nature"
applicationIdSuffix = ".Z"
// A buildConfigField variable here to get com.sample.mycompany[client].X[buildTypes]
}
}
当我使用Build Variant进行编译时: ClientANatureYDebug ,最终的 applicationId 是 com.sample.mycompany.A.Y.dev
我想要一个带有buildConfigField的动态变量(或其他用于检索Java中新变量的变量),它是 com.sample.mycompany.A.X.dev
我想获取最终applicationId 并将当前自然编译维度的applicationIdSuffix替换为.X,并在新变量中获取结果,但是我不知道如何。你能帮我吗?
答案 0 :(得分:0)
已修复:
'</Rate>'