Could not find recyclerview-v7.jar (com.android.support:recyclerview-v7:26.1.0). Searched in the fol

今天遇到个很奇怪的问题,在导入一个新项目的时候,android studio编译报错:

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

Please install the Android Support Repository from the Android SDK Manager.
Open Android SDK Manager

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

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

emm。。。好像没什么问题。尝试clean,Rebuild,删除build文件再clean,更换gradle版本,更换studio版本 ,全部提示同样的错误。
突然我灵机一动,报错是在“ https://jcenter.bintray.com/…”地址不能下载recyclerview,但事实上应该在Google的资源库里面去找对应文件。
尝试把jcenter()和maven 换个先后顺序,根目录下的build文件修改成下面这样,

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

编译通过了!换了无数种办法终于解决了,真要是很忙的任务真能把人急尿

你可能感兴趣的:(Could not find recyclerview-v7.jar (com.android.support:recyclerview-v7:26.1.0). Searched in the fol)