使用maven { url "https://jitpack.io" } 时Failed to resolve:

使用

maven { url "https://jitpack.io" }

拉取第三方依赖时,需要在Porject

repositories {
       // jcenter()
        maven { url "https://jitpack.io" }
    }

例如 SwipeToLoadLayout 这个项目

How to
Step 1. Add the JitPack repository in your build.gradle at the end of repositories:

repositories { maven { url "https://jitpack.io" }}

Step 2. Add the dependency in the form

dependencies { compile 'com.github.Aspsine:SwipeToLoadLayout:1.0.4'}

Step 3. Look over Quick Setup for more details. You can find more customized header view and footer view in the demo app.

只是提示了在repositories中添加maven { url "https://jitpack.io" }
如果你这么做了 ,那么很有可能你会遇到这个问题

Error:(74, 13) 
Failed to resolve: com.github.Aspsine:SwipeToLoadLayout:1.0.4
Show in File
Show in Project Structure dialog

原因是因为你将添加的maven { url "https://jitpack.io" } 添加至了buildscript 而不是allprojects

修改为

allprojects {
    repositories {
        maven { url "https://jitpack.io" }
    }
}

有可能就可以解决问题了。

感谢 http://stackoverflow.com/questions/33058358/jitpack-io-failed-to-resolve-github-repo

点赞