轉 :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' }
