Gradle in Android Studio: Failed to resolve third-party libraries

大城市里の小女人 提交于 2019-11-28 08:24:47
Opal

Add:

repositories {
   mavenCentral()
}

to the build.gradle. Now you have repositories defined only in build script which resolves dependencies only for the buildscript itself not for the project.

corochann

Just to share infomation, I got same problem and the solution was different.

In my case, proxy server was used and it causes the problem. I needed to configure https proxy settings, as discussed in gradle behind proxy in Android Studio 1.3.

If you use VPN | Proxy on your system then use your proxy info in the gradle.properties file in your project like the following lines of code:

# HTTP Proxy
systemProp.http.proxyHost={Host Address}
systemProp.http.proxyPort={Port Number}
systemProp.http.proxyUser={Proxy Username}
systemProp.http.proxyPassword={Proxy Password}
systemProp.http.nonProxyHosts={NonProxy Hosts Address} # like: 127.0.0.1,localhost

# HTTPS Proxy
systemProp.https.proxyHost={Host Address}
systemProp.https.proxyPort={Port Number}
systemProp.https.proxyUser={Proxy Username}
systemProp.https.proxyPassword={Proxy Password}
systemProp.https.nonProxyHosts={NonProxy Hosts Address} # like: 127.0.0.1,localhost

Now just replace {.....} in the above code with appropriate data


Also you can set Android studio proxies like the following image by your proxy info in File>Settings:

Now test again...!

Maybe this help

allprojects {
    repositories {
        jcenter()
    }
}
repositories {
jcenter {
    url "http://jcenter.bintray.com/"
}

// mavenCentral() }

well , if your network connection is fine(wheter using proxy | VPNs or not), simply just try turn off'offline mode' and sync when using android studio with gradle 2.3,this worked for me :)

this helps

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

in projects's gradle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!