为什么我必须在 gradle 中签署 qa flavor?
why do i have to sign qa flavor in gradle?
我的 gradle 文件中有这个构建配置?
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
debug {
applicationIdSuffix ".debug"
versionNameSuffix ".debug"
}
qa {
applicationIdSuffix ".qa"
versionNameSuffix ".qa"
}
}
sourceSets { debug { res.srcDirs = ['src/debug/res', 'src/debug/res/values'] } }
}
为什么当我尝试 运行 质量检查时,它让我感到困惑,并且因为没有这种风格的钥匙而出错?
Gradle 可以构建项目 "out of the box" 的唯一构建类型是 debug
,因为 Gradle 的 Android 插件知道使用插件创建的调试签名密钥库。对于其他一切,您要么需要:
配置单独的签名密钥库(例如,release
)
从 debug
构建类型初始化新构建类型,类似于使用复制构造函数,因此它使用与 debug
签名相同的规则
在下面的示例中,我想定义一个新的 mezzanine
构建类型,为其提供与我用于 release
相同的签名配置。所以,我用mezzanine.initWith(buildTypes.release)
设置mezzanine
作为release
的副本,然后继续用不同的规则配置它:
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "21.1.2"
defaultConfig {
versionCode 2
versionName "1.1"
minSdkVersion 14
targetSdkVersion 18
}
signingConfigs {
release {
storeFile file('HelloConfig.keystore')
keyAlias 'HelloConfig'
storePassword 'laser.yams.heady.testy'
keyPassword 'fw.stabs.steady.wool'
}
}
buildTypes {
debug {
applicationIdSuffix ".d"
versionNameSuffix "-debug"
}
release {
signingConfig signingConfigs.release
}
mezzanine.initWith(buildTypes.release)
mezzanine {
applicationIdSuffix ".mezz"
debuggable true
}
}
}
在您的情况下,您可以在配置 qa
构建类型的其余部分之前使用 qa.initWith(buildTypes.debug)
之类的东西。
我的 gradle 文件中有这个构建配置?
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
debug {
applicationIdSuffix ".debug"
versionNameSuffix ".debug"
}
qa {
applicationIdSuffix ".qa"
versionNameSuffix ".qa"
}
}
sourceSets { debug { res.srcDirs = ['src/debug/res', 'src/debug/res/values'] } }
}
为什么当我尝试 运行 质量检查时,它让我感到困惑,并且因为没有这种风格的钥匙而出错?
Gradle 可以构建项目 "out of the box" 的唯一构建类型是 debug
,因为 Gradle 的 Android 插件知道使用插件创建的调试签名密钥库。对于其他一切,您要么需要:
配置单独的签名密钥库(例如,
release
)从
debug
构建类型初始化新构建类型,类似于使用复制构造函数,因此它使用与debug
签名相同的规则
在下面的示例中,我想定义一个新的 mezzanine
构建类型,为其提供与我用于 release
相同的签名配置。所以,我用mezzanine.initWith(buildTypes.release)
设置mezzanine
作为release
的副本,然后继续用不同的规则配置它:
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "21.1.2"
defaultConfig {
versionCode 2
versionName "1.1"
minSdkVersion 14
targetSdkVersion 18
}
signingConfigs {
release {
storeFile file('HelloConfig.keystore')
keyAlias 'HelloConfig'
storePassword 'laser.yams.heady.testy'
keyPassword 'fw.stabs.steady.wool'
}
}
buildTypes {
debug {
applicationIdSuffix ".d"
versionNameSuffix "-debug"
}
release {
signingConfig signingConfigs.release
}
mezzanine.initWith(buildTypes.release)
mezzanine {
applicationIdSuffix ".mezz"
debuggable true
}
}
}
在您的情况下,您可以在配置 qa
构建类型的其余部分之前使用 qa.initWith(buildTypes.debug)
之类的东西。