http://ask.android-studio.org/?/article/29
Gradle Build Configs
在 app/build.gradle 中,有以下内容:android {
signingConfigs {
release {
storeFile file('keystore')
storePassword 'helloworld'
keyAlias 'Android Release Key'
keyPassword 'helloworld'
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
debug {
applicationIdSuffix ".debug"
}
}
}
signingConfigs 元素用于设置签名文件信息。在本例中,我们使用了 app/keystore 文件为 release 分支进行签名。默认使用 SDK 中的 debug.keystore 为 debug 分支进行签名。
我们可以在 buildTypes 中对 APK 的一些信息可以设置,例如本例中将 debug 分支下 APK 包名在默认的包名后追加 .debug ,从而最终包名为 cc.bb.aa.gradle_build_configs.debug :
debug {
applicationIdSuffix ".debug"
}