0

我有

2种口味

  • 风味1
  • 风味2

5 种构建类型

  • 开发者
  • 调试
  • uat
  • 预制品
  • 发布

我想将完整的 applicationId 设置为

  • com.example.flavor1dev
  • com.example.flavor1debug
  • com.example.flavor1uat
  • com.example.flavor1preprod
  • com.example.flavor1
  • com.example.flavor2.dev
  • com.example.flavor2.debug
  • com.example.flavor2.uat
  • com.example.flavor2.preprod
  • com.example.flavor2

我使用 kotlin-dsl ,请帮忙

4

1 回答 1

0

将您的 build.gradle 更新到下面

   android {
 
   flavorDimensions "flavors" , "enviornment"

    productFlavors {
        flavor1 {
            dimension "flavors"
             applicationId "com.example.flavor1"
         }
        flavour2 {
            dimension "flavors"
            applicationId "com.example.flavor2"
        }
        dev {
            dimension "enviornment"
            manifestPlaceholders.appName = "(DEV)"
            applicationIdSuffix 'dev'
        }
        debug {
            dimension "enviornment"
            manifestPlaceholders.appName = "(Debug)"
            applicationIdSuffix 'debug'
        }
        uat {
            dimension "enviornment"
            manifestPlaceholders.appName = "(UAT)"
            applicationIdSuffix 'uat'
        }
        preprod {
            dimension "enviornment"
            manifestPlaceholders.appName = "(PreProd)"
            applicationIdSuffix 'preProd'
        }
       release {
            dimension "enviornment"
            manifestPlaceholders.appName = "(your app name)"
        }
    }
}
于 2021-09-23T09:49:38.810 回答