根据产品口味设置应用程序ID后缀。

10
我们有2个productFlavorstestServer,liveServer)和2个构建类型(debug,release)。
由于现有的API密钥,我必须基于buildType + productFlavor附加包名称。
例如,像这样的东西:
buildTypes {
  debug {
   applicationIdSuffix '.dbg' + (testServer ? '.test' : '.live')
  }

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

这可能吗?怎么做到的?

1个回答

19
productFlavors {
    testServer {
        applicationId = "com.example.my.pkg.test"
    }
    liveServer {
        applicationId = "com.example.my.pkg.live"
    }
}

buildTypes {
    debug {
        applicationIdSuffix ".debug"
    }
}

欲了解更多信息,请查阅有关应用程序ID的Android文档


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接