Skip to content Skip to sidebar Skip to footer

Error:unknown Host Services.gradle.org. You May Need To Adjust The Proxy Settings In Gradle

i have tried it many times but its giving me same error.how to set the proxy so that this error is solved

Solution 1:

Go to..

File > Settings > Appearance & Behavior > System Settings > HTTP Proxy Enable following option Auto-detect proxy settings

and press checkConnection button for test

Solution 2:

In my case issue occurred after following:

I selected proxy settings from Android Studio settings when I was working in a network behind a proxy. When I disconnected from that network and connected to home network which doesn't have a proxy, I removed the proxy settings from Android Studio, but gradle seemed to take the old proxy settings.

The problem was that gradle had also saved the proxy settings in following file when I set proxy settings in Android Studio, but it hasn't got removed when I removed proxy settings from Android Studio.

%HOME%\.gradle\gradle.properties

When I removed the proxy settings from this file, gradle sync worked again.

Solution 3:

Update your project level build.gradle to latest version - it works for me

classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.2.0'

Solution 4:

I had the same problem. What worked for me was:

Go to File>Invalidate caches/restart>Invalidate and restart.

Hope it works for you too.

If that doesn't work, give your system access to internet and click on Help>Check for Updates. And update android studio to latest versions. All gradle along with plugins will be updated and i guess it should resolve the issue.

Solution 5:

Android Plugin for Gradle HTTP proxy settings

For application-specific HTTP proxy settings, set the proxy settings in the build.gradle file as required for each application module.

apply plugin: 'com.android.application'

android {
    ...
    defaultConfig {
        ...
        systemProp.http.proxyHost=proxy.company.com
        systemProp.http.proxyPort=443
        systemProp.http.proxyUser=userid
        systemProp.http.proxyPassword=password
        systemProp.http.auth.ntlm.domain=domain
    }
    ...
}

For project-wide HTTP proxy settings, set the proxy settings in the gradle/gradle.properties file.

# Project-wide Gradle settings.
...

systemProp.http.proxyHost=proxy.company.com
systemProp.http.proxyPort=443
systemProp.http.proxyUser=username
systemProp.http.proxyPassword=password
systemProp.http.auth.ntlm.domain=domain

systemProp.https.proxyHost=proxy.company.com
systemProp.https.proxyPort=443
systemProp.https.proxyUser=username
systemProp.https.proxyPassword=password
systemProp.https.auth.ntlm.domain=domain

...

Please read Official Document Configuration

Post a Comment for "Error:unknown Host Services.gradle.org. You May Need To Adjust The Proxy Settings In Gradle"