標籤:

安卓Gradle repository庫搜索順序

buildscript repositories搜索順序

buildscript { repositories { jcenter() google() }}

  1. BintrayJCenter
  2. maven
  3. Google

參考:gradle assembleDebug --debug日誌

[org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainComponentMetaDataResolver] Attempting to resolve component for com.android.tools:annotations:26.0.1 using repositories [BintrayJCenter, maven, Google]

project repositories搜索順序

allprojects { repositories { jcenter() google() }}

  1. ${ANDROID_HOME}/extras/m2repository,目前用於存放constraint-layout和constraint-layout-resolver
  2. ${ANDROID_HOME}/extras/google/m2repository
  3. ${ANDROID_HOME}/extras/android/m2repository,目前用於存放databinding和android-support
  4. BintrayJCenter
  5. maven
  6. Google(如果有配置)
  7. flatDir(如果有配置)

參考:gradle assembleDebug --debug日誌

[org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainComponentMetaDataResolver] Attempting to resolve component for com.squareup.leakcanary:leakcanary-android:1.5.4 using repositories [${ANDROID_HOME}/extras/m2repository, ${ANDROID_HOME}/extras/google/m2repository, ${ANDROID_HOME}/extras/android/m2repository, BintrayJCenter, maven, Google, flatDir]

總結

在Gradle 4.0中,BintrayJCenter、maven、Google、flatDir的順序是固定的。是否使用Google和flatDir取決於有無配置。


推薦閱讀:

一個關於Gradle構建緩存的問題
今天開始 Scala
如何在做網上自動化賺錢項目?
國內有Android技術團隊在使用facebook的buck進行代碼構建嗎?

TAG:Android | Gradle |