android 不同的 applicationId 和 applicationIdSuffix 由口味链

问题描述 投票:0回答:0

我有 2 个目标 android 风格,有 2 个不同的客户风格。 我需要:

  1. 具有 appId 和客户不同后缀的第一个目标
  2. 具有不同 appId 的第二个目标,没有任何后缀。

我的尝试:

flavorDimensions "customer","target"
productFlavors {
    customerA {
        dimension "customer"
        applicationId = "com.mycompany.oldappname.customerA"
    }
    customerB {
        dimension "customer"
        applicationId = "com.mycompany.oldappname.customerB"
    }
    targetA{
        dimension "target"
    }
    targetB{
        applicationId = "com.mycompany.newappname"
    }
}

它不适用于 targetB。我在维度客户中定义了 appId,而不是维度目标中的那个。

我试过了:

defaultConfig {
    applicationId "com.mycompany.newappname"
}
...
flavorDimensions "customer","target"
productFlavors {
    customerA {
        dimension "customer"
        applicationIdSuffix = ".customerA"
    }
    customerB {
        dimension "customer"
        applicationIdSuffix = ".customerB"
    }
    targetA{
        dimension "target"
    }
    targetB{
        applicationIdSuffix = ""
        applicationId = "com.mycompany.oldappname"
    }
}

但是我得到了结果 targetB appId = "com.mycompany.oldappname.customerB"

android android-gradle-plugin android-productflavors
© www.soinside.com 2019 - 2024. All rights reserved.