【问题标题】:set applicationIdSuffix depending on productFlavor根据 productFlavor 设置 applicationIdSuffix
【发布时间】:2015-03-27 10:00:47
【问题描述】:

我们有 2 个productFlavorstestServer、liveServer)和 2 种构建类型(debug、release)。

由于现有 API 密钥,我必须根据 buildType + productFlavor 附加包名称。

例如:

buildTypes {
  debug {
   applicationIdSuffix '.dbg' + (testServer ? '.test' : '.live')
  }

  release {
   applicationidSuffix '' + (testServer ? '.test')
  }  
}

这可能吗?怎么样?

【问题讨论】:

    标签: android gradle build.gradle


    【解决方案1】:
    productFlavors {
        testServer {
            applicationId = "com.example.my.pkg.test"
        }
        liveServer {
            applicationId = "com.example.my.pkg.live"
        }
    }
    
    buildTypes {
        debug {
            applicationIdSuffix ".debug"
        }
    }
    

    有关更多信息,请查看有关应用程序 ID 的 Android documentation

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-12-01
      • 2016-06-27
      • 1970-01-01
      • 1970-01-01
      • 2018-05-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多