Android Studio Connection Refused

2019-07-27 05:04发布

问题:

The problem I'm experiencing:

I'm getting the following error when my gradle script tries to build:

> 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'.
           > Connection to https://jcenter.bintray.com refused

What I need to know:

(1) How to resolve Android Studio's connection issue

OR

(2) Where to put the .pom files manually

What I have done so far:

(1) Access the jcenter website manually in a browser and download the files

(2) Set up Android Studio's proxy settings and verified the connection to jcenter via ping in Terminal

(3) Tried using alternate repositories including: mavenCentral() and maven { url 'http://repo1.maven.org/maven2' }

回答1:

I solved my issue.

For whatever reason, the proxy settings in Android Studio's System Settings wasn't transferring over into the gradle build. I suspect that it is due to the fact that Android Studio's proxy settings only seems to offer http and I needed https.

The solution was to enter my proxy settings in gradle.properties:

systemProp.https.proxyHost=my.secure.proxy
systemProp.https.proxyPort=8080