AndroidStudio中看懂gradle构建的groovy的脚本代码:

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zhaihaohao1/article/details/88780314

gradle构建工具学习:
https://www.imooc.com/learn/833
下面是一个脚本文件:

//构建脚本中默认都是有个Project实例的
//apply 方法名,命名参数plugin: 'java'参数外省略了一个小括号
//apply 就是:应用一个插件
apply plugin: 'java'

//属性
version = '0.1'

// repositories 方法名,后面的整个大括号,是一个闭包,作为一个参数调用这个方法
//repositories  仓库,去哪个仓库去找jar包
repositories {
        jcenter()
}

// dependencies 方法名,后面的整个大括号,是一个闭包,作为一个参数调用这个方法
// dependencies 声明依赖jar包
dependencies {
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
}

// task声明任务的,
// 任务的名称是clean
task clean(type: Delete) {
    delete rootProject.buildDir
}

猜你喜欢

转载自blog.csdn.net/zhaihaohao1/article/details/88780314
今日推荐