6

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.

Nicolas Raoul
  • 58,567
  • 58
  • 222
  • 373
user6966
  • 81
  • 1
  • 8

5 Answers5

5

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 
kiranr
  • 2,087
  • 14
  • 32
4

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  
ssgxx
  • 79
  • 7
2

I removed codes below in ~/.gradle/gradle.properties:

systemProp.http.proxyHost=127.0.0.1
systemProp.https.proxyHost=127.0.0.1
systemProp.https.proxyPort=7891
systemProp.http.proxyPort=7891

It works.

yi xia
  • 21
  • 1
1

Try File -> invalidate Caches/Restart!

faraz khonsari
  • 1,924
  • 1
  • 19
  • 27
0

For MAC and Windows users, please go to Users folder and your username folder, then open .gradle folder. Here here you'll find the holy bullshit garbage gradle.properties file. Just edit and clean all content in the file. (There were so many gradle.properties file located in different places)

It worked for me.

#Tue Jun 07 17:07:49 KRAT 2022
#systemProp.http.proxyHost=
#systemProp.https.proxyHost=127.0.0.1
#systemProp.https.proxyPort=80
#systemProp.http.proxyPort=80
#systemProp.https.nonProxyHosts=1.1.1.1
phnghue
  • 1,578
  • 2
  • 10
  • 9