我正在开发一个白色品牌应用程序。
我们为每个客户端创建不同的风格,每个客户端都有Debug
API Production
,所以我试图在 Gradle 中设置它们。
我该怎么做?
这是我尝试过的:
buildTypes {
debug {
// some configurations
}
release {
// some configurations
}
}
flavorDimensions "client"
productFlavors {
company1{
dimension "client"
buildConfigField("String", "BASE_URL", "\"https://app.company1/devApi/\"")
}
company2 {
dimension "client"
buildConfigField("String", "BASE_URL", "\"https://app.company2/devApi/\"")
}
}
编辑:我希望能够为BASE_URL
每个 Flavor 和 Buildtype 定义不同的。
风味 company1,BuildType 调试
https://app.company1.com/devApi/
风味公司 1,BuildType 发布
https://app.company1.com/prodApi/
风味公司2,BuildType调试
https://dev.company2.com/api/
风味公司 2,BuildType 发布
https://prod.company2.com/api/