问题描述
我有一个项目,我有几个设备特定产品的口味,每个口味需要与不同的配置签名:
I've got a project where I have several device-specific product flavors, and each flavor needs to be signed with a different config:
productFlavors {
nexus7 {
signingConfig signingConfigs.nexus7
}
nexus4 {
signingConfig signingConfigs.nexus4
}
}
此建设一个'释放'变种时的伟大工程。然而,使用调试变种(如:当我建立Nexus4Debug),摇篮使用的是默认的Android调试的关键。就我而言,我是高度依赖于这些构建签字正确的方式,如果用默认的调试密钥签名我的应用相对无用的。任何人都知道,如果有一种方法来指定签名的配置对每个变种?
This works great when building a 'release' variant. However, when using a 'debug' variant (e.g. when I build Nexus4Debug), Gradle is using the default android debug key. In my case, I'm highly dependent on these builds being signed the right way, and my application is relatively useless if signed with the default debug key. Anyone know if there's a way to specify the signing config for each variant?
我知道我可以为每个构建类型做到这一点,一拉:
I know I can do it per build type, a la:
buildTypes {
debug {
signingConfig signingConfigs.nexus4
}
}
但是这限制了我总是使用相同的配置签署的调试版本两种口味。
but this limits me to always using the same signing config for debug builds of both flavors.
PS - 了解这是一个边缘的情况下用一点点的在这里。这是一个企业项目中,我们在许多不同的Nexus设备的测试自定义光盘和系统签名的应用程序。
PS - Understand this is a little bit of an edge use case here. This is for an enterprise project where we're testing custom ROMs and system-signed apps on a number of different Nexus devices.
推荐答案
尝试添加到您的 build.gradle 。它会指定 signingConfig
用于每个的味道
建立时,调试
构件类型:
Try adding this to your build.gradle. It will specify which signingConfig
to use for each flavor
when building the debug
build type:
buildTypes {
debug {
productFlavors.nexus4.signingConfig signingConfigs.nexus4
productFlavors.nexus7.signingConfig signingConfigs.nexus7
}
}
这篇关于调试的摇篮产品风味签名配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!