signingConfig
?
- 默认情况下,我希望所有版本都使用主要的发布配置。
- 我只想覆盖1个版本
- 我想能够通过单个
gradlew assembleRelease
命令运行所有发布版本
最后一点很重要,因为我目前有超过120个不同的版本,并且还在增长。为了单独定制每个版本,需要大量的额外工作。
相关的帖子我已经尝试过:
- 这需要为每个风味进行配置
- 它似乎无论如何都不使用我的自定义
signingConfig
- 接受的解决方案对我无效
- 根据评论,这可以通过将
buildTypes
放在productFlavors
中来实现,但我不知道如何做到这一点。
- 如博客文章所解释的那样:使用Gradle构建多个Android应用程序版本
它不起作用实际上它完美地工作- 但对于119种变体,它无法很好地扩展
总的来说,每个解决方案似乎仍然使用默认的发布配置,而不是我的自定义配置。
我的build.gradle
的重要部分如下:
signingConfigs {
releaseConfig {
storeFile file('key')
storePassword "pass"
keyAlias "alias"
keyPassword "pass"
}
custom {
storeFile file('custom_key')
storePassword "pass"
keyAlias "alias"
keyPassword "pass"
}
}
productFlavors {
apple {
applicationId "demo.apple"
}
banana {
applicationId "demo.banana"
}
// def customConfig = signingConfigs.custom
custom {
applicationId "custom.signed.app"
// signingConfig customConfig
}
}
buildTypes {
debug {
applicationIdSuffix ".debug"
}
release {
signingConfig signingConfigs.releaseConfig
// productFlavors.custom.signingConfig signingConfigs.custom
}
}