I am using Android studio 2.2 and I am trying to compile the sample android application given in the get started section of developer.android.com. When I build the application I get the following error.
Could not resolve junit:junit:4.12. Could not get resource 'https://jcenter.bintray.com/junit/junit/4.12/junit-4.12.pom'. Could not GET 'https://jcenter.bintray.com/junit/junit/4.12/junit-4.12.pom'. Connect to jcenter.bintray.com:443 [jcenter.bintray.com/75.126.118.188] failed: Connection timed out: connect
I have gone through a number of threads in stackoverflow.com related to this error. I did the following as suggested in these threads, but my problem is not resolved.
Updated buildgrid{} section of build.gradle (application) with this:
repositories {
maven { url 'http://repo1.maven.org/maven2' }
}
Updated android{} section of build.gradle (module) with this:
repositories {
maven { url 'http://repo1.maven.org/maven2' }
}
I have also configured manual proxy with a proper proxy server IP and I could also test the connection successuflly to URL https://jcenter.bintray.com/junit/junit/4.12/junit-4.12.pom. I have also pasted this URL in a web browser, which downloads the junit-4.12.pom successfully. What I am not able to understand is, when connection to the above URL is successful, why the build fails?
Add below repository in your build.gradle file,
repositories {
maven { url 'http://repo1.maven.org/maven2' }
jcenter { url "http://jcenter.bintray.com/" }
}
I had this problem today. For me it was a proxy settings issue.
I opened the file 'gradle.properties
' in my project and added the following settings. Then everything synchronized and downloaded for me.
systemProp.http.proxyHost=XX.XX.XX.XX
systemProp.http.proxyPort=80
systemProp.https.proxyHost=XX.XX.XX.XX
systemProp.https.proxyPort=80
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With