您的位置:首页 > 产品设计 > UI/UE

Gradle Plugin Samples 之 Gradle Build Configs(五)

2015-07-20 15:03 351 查看
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"

}


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: