Connect to jcenter.bintray.com:443 [jcenter.bintray.com/] failed: Connection refused: connect

Like Tweet Pin it Share Share Email

If you are at this page, it means that you have are working on creating project in android studio to automate mobile app testing, and when android studio tries to build the project by pulling dependencies through gradle, it says BUIL FAILED with errors and you might end up in some error details like below

Error:Gradle: A problem occurred configuring root project ‘MobileTesting’.
> Could not resolve all dependencies for configuration ‘:classpath’.
> Could not resolve com.android.tools.build:gradle:2.3.0.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:2.3.0.
> Could not get resource ‘https://jcenter.bintray.com/com/android/tools/build/gradle/2.3.0/gradle-2.3.0.pom’.
> Could not GET ‘https://jcenter.bintray.com/com/android/tools/build/gradle/2.3.0/gradle-2.3.0.pom’.
> Connect to jcenter.bintray.com:443 [jcenter.bintray.com/] failed: Connection refused: connect

There is nothing to worry about, one of the reasons could be that, if you are working in an office environment, where you are supposed to be behind a proxy to access internet, we need to let gradle know that you have to use proxy so that it can pull required dependencies via your office proxy server.

Ideally, when you were creating the project, android studio might have prompted with a window to provide proxy settings, something like below:

But in case you closed it by chance as you were not aware while creating the project that you need to provide proxy server details. Sometimes it might not popup as well, but there is nothing you need to worry about, follow the below steps and you are good to go 🙂

  • Open gradle.properties file of your android project @ android studio
  • Paste below details and replace required info based on your proxy server details:
    systemProp.http.proxyHost={your proxy ip address}
    systemProp.http.proxyPort={your proxy port number, mostly 8080}
    systemProp.https.proxyHost={your proxy ip address}
    systemProp.https.proxyPort={your proxy port number, mostly 8080}

    Please make sure you do not have duplicate entries in the file.

  • Save the project
  • Close Android studio
  • Open Android studio and wait for BUILD to complete, this time it should be BUILD SUCCESSFUL 🙂

In case you do not know, what details are to be provided for Proxy Server and https proxy server details, you can follow below steps to get the details.

  • Open Internet Properties window from Internet Explorer or by giving inetcpl.cpl command in Windows Run command.
  • Navigate to Connections tab in Internet Properties Window
  • Click on LAN Settings button
  • You will be presented with a small window and you can see details provided in Proxy Server section:
  • This is where you can find the required details.

In case you do not have permissions to access the internet properties, we recommend you to reach out to your IT team and get the details for the same.

And in the worst case, you can connect at your home network where there is no need for proxy server details to access internet and the BUILD should happen without any issues.

Hope this article might have helped you in solving the error, in case you have any further issues, please share them through comments and we would try our best to solve the same.

Comments (0)

Leave a Reply

Your email address will not be published. Required fields are marked *