Failed to resolve: support-fragment(已解决)

2020-11-25 15:05:45 浏览数 (1)

问题出现

在不同电脑Android Studio上运行同一个项目,出现

代码语言:javascript复制
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
代码语言:javascript复制
Failed to resolve: support-fragment
Open File

解决这个问题只需要在build.gradle文件里修改allprojects 里面的repositories,把google放到jcenter前面就可以了

原文件

代码语言:javascript复制
allprojects {
    repositories {
        jcenter()
        mavenCentral()
        maven { url 'https://maven.google.com' }
        maven { url "https://dl.google.com/dl/android/maven2/"}
    }
}

修改后

代码语言:javascript复制
allprojects {
    repositories {
        maven { url 'https://maven.google.com' }
        jcenter()
        mavenCentral()
        maven { url "https://dl.google.com/dl/android/maven2/"}
    }
}

0 人点赞