build gradle dependencies闭包的详解

转 :https://blog.csdn.net/guanguanboy/article/details/91043641

dependencies闭包的整体功能是指定当前项目所有依赖关系:本地依赖、库依赖及远程依赖。

本地依赖:可以对本地Jar包或者目录添加依赖关系

库依赖:可以对项目中的库模块添加依赖关系

远程依赖:可以对jcenter库上的开源项目添加依赖,标准的远程依赖格式是:域名:组织名:版本号

dependencies {
   implementation fileTree(dir: 'libs', include: ['*.jar']) // 本地依赖
   // 远程依赖,com.android.support是域名部分,appcompat-v7是组名称,26.1.0是版本号
  implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
     implementation project(':hello') // 库依赖
    testImplementation 'junit:junit:4.12' // 声明测试用列库
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
 }

 

posted @ 2019-11-22 16:57  IT路上的小白  阅读(1865)  评论(0编辑  收藏  举报