简体   繁体   English

Android Studio:Gradle无法解决依赖关系

[英]Android Studio: Gradle failed to resolve dependencies

Getting error: 出现错误:

Gradleconnectioncheck:app:unspecified Could not resolve com.github.pstovk:MaterialDesignLibrary:1.3. Gradleconnectioncheck:app:unspecified无法解析com.github.pstovk:MaterialDesignLibrary:1.3。

Could not GET ' https://jcenter.bintray.com/com/github/pstovk/MaterialDesignLibrary/1.3/MaterialDesignLibrary-1.3.pom '. 无法获取' https://jcenter.bintray.com/com/github/pstovk/MaterialDesignLibrary/1.3/MaterialDesignLibrary-1.3.pom '。 jcenter.bintray.com jcenter.bintray.com

  1. I've used proxy setting in Android Studio. 我在Android Studio中使用了代理设置。 And also tried this solution ( Link ) which sets proxy in gradle, but It didn't work. 并且还尝试了将此解决方案( Link )设置为gradle的代理,但没有用。

settings: 设置:

systemProp.https.proxyHost=http-proxy.nwie.net
systemProp.https.proxyPort=8080
systemProp.https.proxyUser=http-proxy.nwie.net/%USERNAME%
systemProp.https.proxyPassword=%PASSWORD%`
  1. There is already jcenter() in build.gradle, which was suggested in Link 在build.gradle中已经有jcenter() ,这在链接中建议

code: 码:

repositories {
    jcenter()
}

I fixed this issue by adding code : 我通过添加代码解决了这个问题:

allprojects {
    repositories {
        jcenter()
    }
}

Make sure to include both http and https settings for proxyHost, proxyUser, and proxyPassword. 确保同时包括proxyHost,proxyUser和proxyPassword的http和https设置。

If that doesn't work, see this similar issue: https://github.com/navasmdc/MaterialDesignLibrary/issues/288 如果那不起作用,请参见以下类似问题: https : //github.com/navasmdc/MaterialDesignLibrary/issues/288

Try gradle sync and/or clean and build again like so: 尝试gradle同步和/或清理并再次构建,如下所示:

Tools -> Android -> Sync Project with Gradle Files

If that fails, try running 'Rebuild project': 如果失败,请尝试运行“重建项目”:

Build -> Rebuild Project

Also try switching over to navasmdc's repo of Material Design: https://github.com/navasmdc/MaterialDesignLibrary 还可以尝试切换到navasmdc的Material Design仓库: https : //github.com/navasmdc/MaterialDesignLibrary

I tried using systemProp.proxySet=true and http & https both and It's working! 我尝试使用systemProp.proxySet = true和http&https都使用,并且可以正常工作!

systemProp.proxySet=true
systemProp.http.proxyHost=http-proxy.nwie.net
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=http-proxy.nwie.net/%USERNAME%
systemProp.http.proxyPassword=%PASSWORD%`

systemProp.https.proxyHost=http-proxy.nwie.net
systemProp.https.proxyPort=8080
systemProp.https.proxyUser=http-proxy.nwie.net/%USERNAME%
systemProp.https.proxyPassword=%PASSWORD%`

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM