Reputation: 1
I was trying to create some android sample app using android studio and I came across a gradle sync error.
It says unknown host for jcenter.bintray.com and configure proxy.
But when I try to access it using browser url is accessible. I also tried to check connection in android studio > setting > system settings > http proxy > check connection.
It shows connection successful. So the error occurs only when it builds. what could be the reason?
build.gradle
buildscript {
repositories {
jcenter { url "http://jcenter.bintray.com/" }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.1'
}
}
allprojects {
}
Upvotes: 0
Views: 6253
Reputation: 3174
If it is internet access issue than please check and configure proxy url in the android studio preferences and set Manual proxy url with port.
Upvotes: 0
Reputation: 889
Remove testCompile 'junit:junit:4.12' from build.gradle file, If you are not using unit test.
If you need test case, Set up proxy settings(file->settings->appearance & behaviour ->system settings->http proxy ) , if you are behind proxy.
and add below repository in build.gradle,
repositories {
maven { url 'http://repo1.maven.org/maven2' }
jcenter { url "http://jcenter.bintray.com/" }
}
Upvotes: 0
Reputation: 14073
This happens because the android studio could not able to fetch the dependencies from the repository.
Try updating android studio to newer version
, along with deactivating offline mode
got it to work.
Upvotes: 0