avez raj
avez raj

Reputation: 2145

Error:Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy settings either in IDE or Gradle

i am fed up of this error i am not getting how to solve this error its not setting to auto configuration mode.i am trying to auto configure it but it needs the auto configure URL i don't know the URL. it is giving the same error to all the projects which we import.please help this error i am trying it from so many days

Upvotes: 13

Views: 51218

Answers (8)

Awstine jessy
Awstine jessy

Reputation: 1

I set the HTTP proxy to automatic, checked the connection once it said successful I was good on running my Gradle smoothly

Upvotes: 0

Faith
Faith

Reputation: 11

if you're not using any proxy, are getting this error and you are connected to VPN, disconnecting from you VPN might help :)

Upvotes: 0

Jorgesys
Jorgesys

Reputation: 126523

The solution is to open your local.properties file, if you are using a Proxy server, set your appropiater configuration:

systemProp.https.proxyHost=proxyserver
systemProp.https.proxyPort=8080

otherwise, just set:

systemProp.https.proxyHost=
systemProp.https.proxyPort=

Sometimes the cache, will continue having proxy´s information, and you will still having the message:

Error:Connection timed out: connect. If you are behind an HTTP proxy, please configure the proxy settings either in IDE or Gradle

In this case, you have to invalidate Android Studio´s cache.

File > Invalidate Caches...

Upvotes: 0

C JT
C JT

Reputation: 1

If you are using proxy for your own browser, just enter the "File -> Appearance & Behavior -> System Settings -> HTTP Proxy", and choose the "Manual proxy configuration", then choose "HTTP", type in "127.0.0.1" in "Host name" and the port number of your own proxy. That is worked for me. enter image description here

Upvotes: 0

Reyhane Farshbaf
Reyhane Farshbaf

Reputation: 543

In my case, because my system configured to an http proxy, I found some below settings in gradle.properties(Global prperties). May be this file doesnt exist in all projects, but to display put your android studio root on Android. after remove mentioned settings (below) error solved.

systemProp.http.proxyHost=
systemProp.https.proxyHost=
systemProp.https.proxyPort=80
systemProp.http.proxyPort=80

enter image description here

Upvotes: 8

Akif
Akif

Reputation: 7650

Sometimes, even you are not behind an http proxy, you need to configure them with dummy data like this:

systemProp.http.proxyHost=www.anyhost.com
systemProp.http.proxyPort=80 

Upvotes: 1

vovahost
vovahost

Reputation: 36017

If you're not using any proxies then:

  1. Delete /project_directory/.gradle folder
  2. Clean your project (Build -> Clean Project).
  3. Sync project again

It should be working after these steps.

In my case I starting having this error after I updated:

Gradle plugin 3.6.3 -> 4.0.0
Gradle: 5.6.4 -> 6.1.1

Upvotes: 7

Rahul Sonone
Rahul Sonone

Reputation: 2745

First check your internet proxy settings copy the proxy settings like proxy host and port no. and go to your "gradle.properties" file in project and paste it like this

systemProp.http.proxyHost="copied proxy host"
systemProp.http.proxyPort="copied proxy port"

systemProp.https.proxyHost="copied proxy host"
systemProp.https.proxyPort="copied proxy port"

Generally people paste the system prop for http but forget for https so please paste both.

Upvotes: 4

Related Questions