gpt4 book ai didi

android - Android风格签名无法正常工作

转载 作者:行者123 更新时间:2023-12-03 05:30:46 25 4
gpt4 key购买 nike

我需要使用特定的签名配置来签名产品 flavor 。我在stackoverflow上找到了一些引用,例如thisthis。它适用于我的flavor发布版本,但不适用于调试版本。我在gradle中有此配置:

...
signingConfigs {
release {
storeFile file("../config/keystores/release_keystore")
storePassword "mysecurepassword"
keyAlias "myultrasecurealias"
keyPassword "myreallysecurekeypassword"
}

debug {
storeFile file("../config/keystores/debug.keystore")
storePassword "mysecurepassword"
keyAlias "myultrasecurealias"
keyPassword "myreallysecurekeypassword"
}

other {
storeFile file("../config/keystores/other")
storePassword "mysecurepassword"
keyAlias "myultrasecurealias"
keyPassword "myreallysecurekeypassword"
}
}

flavorDimensions "dim"

productFlavors {
production {
dimension "dim"
}

other {
dimension "dim"
}
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
productFlavors.other.signingConfig signingConfigs.other
productFlavors.production.signingConfig signingConfigs.release
}

debug {
productFlavors.other.signingConfig signingConfigs.other
productFlavors.production.signingConfig signingConfigs.debug
}
}

这对于 otherRelease风格非常有效。但是当我使用构建配置 other时,我的APK没有被 otherDebug签名配置所吸引。 release版本已正确签名。

有谁知道为什么在 Debug模式下签名配置未按配置应用?

最佳答案

我终于弄清楚了什么地方出了问题,这要归功于@AllanHasegawa在另一个问题Signing product flavors with gradle中的评论。简而言之,我必须在signingConfig null中添加buildTypes,因为Android添加了一些默认的签名配置。即使我试图覆盖它。根据我的问题的完整示例:

...
signingConfigs {
release {
storeFile file("../config/keystores/release_keystore")
storePassword "mysecurepassword"
keyAlias "myultrasecurealias"
keyPassword "myreallysecurekeypassword"
}

debug {
storeFile file("../config/keystores/debug.keystore")
storePassword "mysecurepassword"
keyAlias "myultrasecurealias"
keyPassword "myreallysecurekeypassword"
}

other {
storeFile file("../config/keystores/other")
storePassword "mysecurepassword"
keyAlias "myultrasecurealias"
keyPassword "myreallysecurekeypassword"
}
}

flavorDimensions "dim"

productFlavors {
production {
dimension "dim"
}

other {
dimension "dim"
}
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

// this loop is a better implementation than my previous example
productFlavors.all { flavor ->
flavor.signingConfig signingConfigs.release
}
productFlavors.other.signingConfig signingConfigs.other
}

debug {
signingConfig null
// this loop is a better implementation than my previous example
productFlavors.all { flavor ->
flavor.signingConfig signingConfigs.debug
}
productFlavors.other.signingConfig signingConfigs.other
}
}

关于android - Android风格签名无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59426636/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com