Android build.gradle(app)介绍

/**首先第一行应用了一个插件,一般有两个值可选,com.android.application表示这是一个应用程序模块,
 * com.android.library表示这是一个库模块。应用模块和库模块的最大区别是:一个是可以直接运行的,一个只能做为代码库
 * 依附于其他应用程序模块来运行。
 */
apply plugin: 'com.android.application'

android {
//  用于指定项目的编译版本
    compileSdkVersion 26
//  用于指定项目构建工具的版本
    buildToolsVersion "26.0.0"
//
    defaultConfig {
        applicationId "com.zjs.guanggaoshanping"
//      用于指定项目最低兼容的Android系统版本。
        minSdkVersion 15
//      指定的值表示你在该目标版本上已经做过了充分的测试,系统将会为你的应用程序启动一些最新的功能和特性。比如说Android6.0
//      系统中引入了运行时权限这个功能,如果你将值设置为23或者更高,那么系统会为你的程序启用运行时权限功能,如果将值设置我22,
//      那么就说明你的程序最高只在Android5.1系统上做过充分的测试,Android6.0中引入的新功能自然不会启用。
        targetSdkVersion 26
//      用于指定项目的版本号
        versionCode 1
//      用于指定项目的版本名
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        /**用于指定生成安装文件的相关配置,通常只会有两个子闭包,一个是debug,一个是release,
         * debug用于指定生成测试版安装文件的配置,release用于指定生成正式版安装文件的配置。
         * 另外debug是可以忽略不写的。
         */
        release {
//            用于指定是否对象的代码进行混淆 (true表示混淆,false表示不混淆)
            minifyEnabled false
//            用于指定混淆时,使用的规则文件,
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值