Android studio on mac: remove proxy settings

I work on macOS High Sierra with Android Studio 3.1 (same problem with 2.3).

I had previously a proxy settings, but actually we stop using proxy.

When i try to update gradle to 4.4 (or other version) android studio apprently continue to use an old proxy settings.

Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve com.android.tools.build:gradle:4.4.
Caused by: org.gradle.api.resources.ResourceException: Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/4.4/gradle-4.4.pom'.
Caused by: org.gradle.internal.resource.transport.http.HttpRequestException: Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/4.4/gradle-4.4.pom'.
Caused by: org.apache.http.conn.ConnectTimeoutException: Connect to proxy-********:8080 [proxy-********/172.20.10.5] failed: connect timed out

I already disabled the proxy in preferences > system settings > HTTP Proxy.

Someone have an idea?

Upvotes: 27

Views: 15893

Answers (5)

I finally fixed my problem, if someone needs the solution:

My old proxy settings were stored in the file ~/.gradle/gradle.properties

Upvotes: 97

dungnt275
dungnt275

Reputation: 31

In my case, after removing proxy from following places,

  1. File > Settings > System settings > HTTP Proxy Project

  2. gradle.properties

my Android Studio still connects to github via proxy. Then I ran the following command to remove proxy for git (I use Windows).

git config --global --unset http.proxy

Now, my Android Studio does not connect to proxy. Hope this helps.

Upvotes: 3

vineeshvs
vineeshvs

Reputation: 565

Remove proxy from all of the following places.

  1. File > Settings > System settings > HTTP Proxy
  2. Project gradle.properties
  3. ~/.gradle/gradle.properties (As mentioned in the previous answer by @seorefbe)

Upvotes: 16

Amresh Deshpande
Amresh Deshpande

Reputation: 287

Go to Android Studio ->Preferences ->search Gradle

You will find path to your Gradle home defined here
Service directory path :/Users/username/.gradle

Go to this path from finder and update gradle.properties to enable disable proxy(comment proxy set here)

Upvotes: 16

grassyburrito
grassyburrito

Reputation: 1243

Gradle daemon retains the reference to proxy even after removing them from the System Preferences. So I had to kill the daemon and start it again to make it work.

./gradlew --stop

Upvotes: 17

Related Questions