app目录下的build.gradle详解

主要参考自《第一行代码》
// 表示这是一个Android程序模块,如果是作为库,就声明为Library'com.android.library'
apply plugin: 'com.android.application'

android {
    compileSdkVersion 26 // 编译版本,指用哪个版本的SDK进行编译
    buildToolsVersion "26.0.1" //构建工具
    //对项目的更多细节进行配置
    defaultConfig {
        applicationId "com.seachal.myapplicationtestlog"
        minSdkVersion 19
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    //指定生成安装文件的相关配置
    buildTypes {
        //release 闭包用于指定生成正式版安装文件的配置
        release {
            minifyEnabled false //指定是否对项目的代码进行混淆, true 表示混淆, false 表示不混淆。
            //proguard-android.txt在默认的SDK目录下,有通用的混淆规则
            // proguard-rules.pro 有本项目专用的混淆规则
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        //debug闭包可以忽略不写
    }
}

dependencies {
    //本地依赖声明,它表示将 libs 目录下所有.jar 后缀的文件都添加到项目的构建路径当中
    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.+'
    //com.android.support.constraint 是域名。constraint-layout是组名,用于区分同一公司的不同库。 1.0.2是版本号
    compile 'com.android.support.constraint:constraint-layout:1.0.2'

    //compile project(':helper')  //库依赖声明格式,表示依赖了一个叫helper的Library
    // 声明测试用例库
    testCompile 'junit:junit:4.12'
}

  • 4
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值