Failed to resolve: support-fragment(已解決)
阿新 • • 發佈:2019-02-17
問題出現
在不同電腦Android Studio上運行同一個專案,出現
Could not find support-fragment.jar (com.android.support:support-fragment:27.1.1).
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/support-fragment/27.1.1/support-fragment-27.1.1.jar
Please install the Android Support Repository from the Android SDK Manager.
Open Android SDK Manager
Failed to resolve: support-fragment
Open File
解決這個問題只需要在build.gradle檔案裡修改allprojects 裡面的repositories,把google放到jcenter前面就可以了
原檔案
allprojects {
repositories {
jcenter()
mavenCentral()
maven { url 'https://maven.google.com' }
maven { url "https://dl.google.com/dl/android/maven2/" }
}
}
修改後
allprojects {
repositories {
maven { url 'https://maven.google.com' }
jcenter()
mavenCentral()
maven { url "https://dl.google.com/dl/android/maven2/"}
}
}