Reputation: 1148
So I'm having a connection error with Gradle, even after setting up my proxy. I'm trying to build a project downloaded off GitHub. I loaded it and when I try to build I get the error Gradle sync failed: Connection refused: connect
. I made sure I set up my proxy configuration, as that is usually what causes this problem. When I run Check connection
in the Proxy Settings, it comes back successful. I even created a new project with the same exact gradle.properties
, and it was able to download all the Gradle files.
Any ideas why this is happening for an already existing project?
Thanks.
Upvotes: 2
Views: 3905
Reputation: 391
For me it was a problem created by the gradle.properties
file in Android Studio.
I do not use HTTP Proxy for any of my project while refreshing, syncing or building my Gradle and that's where the problem lied.
The project I cloned and then imported in the Android Studio had its own gradle.properties
file where the proxy were set according to the someone else's configuration. I just deleted those five lines of code for proxy set-up in the gradle.properties
file and just refreshed the gradle build again and it worked just fine for me.
These five lines were extra in my case:
systemProp.https.proxyPort=8080
systemProp.http.proxyHost=172.16.30.20
org.gradle.jvmargs=-Xmx1536m
systemProp.https.proxyHost=172.16.30.20
systemProp.http.proxyPort=8080
So I guess there might be a proxy configuration in gradle.properties
file that you might have to change according to your default proxy configuration.
Hope it helps.
Upvotes: 1