I have been trying to switch my project from Intellij to Android Studio, which has required me to create a build.gradle file. I know I can add each of these as a library dep
this helps
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
in projects's gradle
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...!
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.
Maybe this help
allprojects {
repositories {
jcenter()
}
}
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.
repositories {
jcenter {
url "http://jcenter.bintray.com/"
}
// mavenCentral() }