前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >app目录下的build.gradle详解

app目录下的build.gradle详解

原创
作者头像
Seachal
修改2021-01-25 14:35:43
6040
修改2021-01-25 14:35:43
举报
文章被收录于专栏:SeacahlSeacahl

最近把以前的gradle知识点整理下

代码语言:txt
复制
// 表示这是一个Android程序模块,如果是作为库,就声明为Library'com.android.library'

applyplugin:'com.android.application'

android {

    compileSdkVersion 26// 编译版本,指用哪个版本的SDK进行编译

    buildToolsVersion "26.0.1"//构建工具

    //对项目的更多细节进行配置

    defaultConfig {

    applicationId"com.seachal.myapplicationtestlog"

    minSdkVersion 19

    targetSdkVersion 26

    versionCode1

    versionName "1.0"

    testInstrumentationRunner"android.support.test.runner.AndroidJUnitRunner"

}

//指定生成安装文件的相关配置

buildTypes {

      //release 闭包用于指定生成正式版安装文件的配置

      release {

      minifyEnabledfalse//指定是否对项目的代码进行混淆, 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', {

        excludegroup:'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'

}

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档