根据productFlavor设置applicationIdSuffix [英] set applicationIdSuffix depending on productFlavor
本文介绍了根据productFlavor设置applicationIdSuffix的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们有2个 productFlavors
( testServer,liveServer )和2个构建类型( debug,release)。
由于现有的API密钥,我必须添加基于buildType + productFlavor的包名。
例如,例如:
buildTypes {
debug {
applicationIdSuffix'.dbg'+(testServer?'.test ':'.live')
}
release {
applicationidSuffix''+(testServer?'.test')
}
}
这可能吗?如何?
解决方案
productFlavors {
testServer {
applicationId = com.example.my.pkg.test
}
liveServer {
applicationId =com.example.my.pkg.live
}
}
buildTypes {
debug {
applicationIdSuffix.debug
}
}
有关更多信息,请查看有关应用程序id的Android文档。
We have 2 productFlavors
(testServer, liveServer) and 2 build types (debug, release).
Due to existing API keys, I have to append package names based on buildType + productFlavor.
For example something like:
buildTypes {
debug {
applicationIdSuffix '.dbg' + (testServer ? '.test' : '.live')
}
release {
applicationidSuffix '' + (testServer ? '.test')
}
}
is this possible? how?
解决方案
productFlavors {
testServer {
applicationId = "com.example.my.pkg.test"
}
liveServer {
applicationId = "com.example.my.pkg.live"
}
}
buildTypes {
debug {
applicationIdSuffix ".debug"
}
}
For more information, take a look at the Android documentation regarding application ids.
这篇关于根据productFlavor设置applicationIdSuffix的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文