Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio: Connect to 127.0.0.1:8118 [/127.0.0.1] failed: Connection refused: connect

I am trying to build this project https://github.com/deeplearning4j/dl4j-examples/tree/master/android/DL4JIrisClassifierDemo in Android Studio, and I get:

> Could not resolve com.android.tools.build:gradle:3.0.1.
         > Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.pom'.
         > Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.pom'.
         > Connect to 127.0.0.1:8118 [/127.0.0.1] failed: Connection refused: connect

I have tried all the options from the comments in this issue Gradle sync failed: Connection refused and I can't seem to get it working... I don't know what the problem is, I even disabled my antivirus and firewall, and I still get Connect to 127.0.0.1:8118 [/127.0.0.1] failed. Internet Options --> Connections --> LAN Settings does not show any proxies and additionally in Android Studio the HTTP Proxy setting is set to "no proxy", so I REALLY DON'T KNOW what else to consider as an option to make this work. Please give me your insights/thoughts/experiences on this one...

I work with Android Studio 3.3.2.

like image 930
user6966 Avatar asked Jul 16 '19 20:07

user6966


2 Answers

check your gradle config file at somewhere like ~/.gradle/gradle.properties is there some configs for proxy like below:

systemProp.https.proxyPort=8118
systemProp.http.proxyHost=127.0.0.1
systemProp.https.proxyHost=127.0.0.1
systemProp.http.proxyPort=8118  
like image 163
ssgxx Avatar answered Oct 05 '22 06:10

ssgxx


I removed these lines from gradle.properties file and it worked for me.

systemProp.https.proxyPort=8118
systemProp.http.proxyHost=127.0.0.1
systemProp.https.proxyHost=127.0.0.1
systemProp.http.proxyPort=8118 
like image 21
kiranr Avatar answered Oct 05 '22 07:10

kiranr