所以这很简单。您可以不费吹灰之力地修改每种风味或发布类型。
如果您试图在多个维度上重用一种风味,那不是他们想要的功能。风味意味着是应用程序的构建编译打包版本。它并不是真正意义上的通用参数集。因此,您需要为每种差异提供一种风味,例如
  风味 1 -> 在维度 1
  
  flavor1Dimension2 -> 在维度 2
  
  风味 2 -> 在维度 1
  
  flavor2Dimension2 -> 在维度 2 等..
这里我举一个使用动态的例子
当然,您还可以做更多事情,但这应该可以满足您的要求。
flavorDimensions 'default', 'secondary'
productFlavors {
    a35Demo {
        dimension 'default'
        applicationId "com.appstudio35.yourappstudio.demo"
        buildConfigField "int", "BUSINESS_ID", "1"
        resValue "string", "app_name", "App Studio 35"
        buildConfigField "String", "NOTIFICATION_ICON", '"ic_launcher"'
        manifestPlaceholders = [iconPath:"@mipmap/ic_launcher", roundIconPath:"@mipmap/ic_launcher_round"]
    }
    smallville {
        dimension 'secondary'
        applicationId "com.appstudio35.yourappstudio.smallville"
        buildConfigField "int", "BUSINESS_ID", "22"
        resValue "string", "app_name", "Smallville"
        buildConfigField "String", "NOTIFICATION_ICON", '"ic_launcher_smallville"'
        manifestPlaceholders = [iconPath:"@mipmap/ic_launcher_smallville", roundIconPath:"@mipmap/ic_launcher_round_smallville"]
    }
}
buildTypes {
    debug {
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        buildConfigField "String", "SERVER_URL", '"https://api.dev.myurl.com"'
        shrinkResources false //remove unused resources per flavor
        minifyEnabled false
    }
    release {
        buildConfigField "String", "SERVER_URL", '"https://api.prod.myurl.com"'
        shrinkResources true //remove unused resources per flavor
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        //production builds
        productFlavors.a35Demo.signingConfig signingConfigs.releaseA35YourAppStudio
        productFlavors.smallville.signingConfig signingConfigs.releaseA35YourAppStudio
    }
}
快乐编码!