4

Gradle Plugin Samples 之 Gradle Build Configs(五)

 3 years ago
source link: http://www.androidchina.net/3886.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

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"
}

转载请注明:Android开发中文站 » Gradle Plugin Samples 之 Gradle Build Configs(五)


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK