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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM