Gradle Build Configs

来源:互联网 发布:最火的韩网络剧短剧 编辑:程序博客网 时间:2024/05/14 13:24


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