Failed to resolve:recyclerview-v7或Could not find recyclerview-v7.jar的报错问题

今天在构建项目的时候发现者这个问题:

Error:Could not resolve all files for configuration ':BaseLib:debugCompileClasspath'.
> Could not find recyclerview-v7.jar (com.android.support:recyclerview-v7:26.1.0).
  Searched in the following locations:
      https://jcenter.bintray.com/com/android/support/recyclerview-v7/26.1.0/recyclerview-v7-26.1.0.jar

前前后后检查了好几遍,项目中没有任何地方用到recyclerview,可能是某个依赖引用导致。检查项目根目录的build文件,发现是这么写的:

allprojects {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        google()

    }
}

仔细分析了一下报错是在“ https://jcenter.bintray.com/…”地址不能下载recyclerview,但事实上应该在Google的资源库里面去找对应文件。
尝试把jcenter()和maven 换个先后顺序,根目录下的build文件修改成下面这样

allprojects {
    repositories {
        //注意jcenter()和maven的顺序不要写错
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        google()
        jcenter()
    }
}

编译通过了。

发布了116 篇原创文章 · 获赞 165 · 访问量 17万+

猜你喜欢

转载自blog.csdn.net/qq_42618969/article/details/90670518
今日推荐