spi*_*ce7 13 android android-gradle-plugin
我有一个有2种口味的Android应用程序:internal而且production,还有2种构建类型:debug和release.
我正在尝试根据风格分配签名配置,根据文档是可行的.我看了之后发现了其他答案,但似乎都没有.所有内容都会编译,但应用程序正在使用本机的本地调试密钥库进行签名.
这是我的gradle文件:
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0.0"
}
signingConfigs {
internal {
storeFile file("../internal.keystore")
storePassword "password"
keyAlias "user"
keyPassword "password"
}
production {
storeFile file("../production.keystore")
storePassword "password"
keyAlias "user"
keyPassword "password"
}
}
productFlavors {
internal {
signingConfig signingConfigs.internal
applicationId 'com.test.test.internal'
}
production {
signingConfig signingConfigs.production
applicationId 'com.test.test'
}
}
buildTypes {
debug {
applicationIdSuffix ".d"
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
variantFilter { variant ->
if (variant.buildType.name.equals('debug')
&& variant.getFlavors().get(0).name.equals('production')) {
variant.setIgnore(true);
}
}
}
Run Code Online (Sandbox Code Playgroud)
注意:我也在编译 classpath 'com.android.tools.build:gradle:1.1.3'
spi*_*ce7 23
似乎默认情况下,Android signingConfig在调试构建类型(android调试密钥库)上有一个集合,当signingConfig为构建类型设置时,signingConfig会忽略调整.
解决的办法是设置signingConfig于null上调试版本类型.然后将使用signingConfig给定的味道:
buildTypes {
debug {
// Set to null to override default debug keystore and defer to the product flavor.
signingConfig null
applicationIdSuffix ".d"
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3258 次 |
| 最近记录: |