Error:Unknown host services.gradle.org. You may ne

2019-01-26 19:30发布

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

7条回答
贼婆χ
2楼-- · 2019-01-26 20:08

I tried more than 50 Stackoverflow threads. Nothing helped me.

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'
查看更多
一纸荒年 Trace。
3楼-- · 2019-01-26 20:08

If you are using an http proxy server, revise the following proxy settings in "gradle.properties" file in your project's root folder. If not using proxy server, just delete those entries.

systemProp.http.proxyPort=8080
systemProp.http.proxyUser=UserName
systemProp.http.proxyPassword=Passw0rd
systemProp.https.proxyPassword=Passw0rd
systemProp.https.proxyHost=proxy.abc.com
systemProp.http.proxyHost=proxy.abc.com
systemProp.https.proxyPort=8080
systemProp.https.proxyUser=UserName
查看更多
孤傲高冷的网名
4楼-- · 2019-01-26 20:13

Download a recent gradle release from gradle.org/releases Unzip the file and copy the gradle folder e.g. gradle 4.0 into C -- program files -- android -- android studio -- gradle. On your android studio goto file -- settings -- Build, Execution, Deployment --Build Tools -- Gradle and choose Use local gradle distribution, in the gradle home locate your gradle folder and click apply. Then click okay. This solved the problem for me. Your android studio might require a more recent gradle release, make sure you download a gradle that is compatible with your studio or latest releases.

查看更多
混吃等死
5楼-- · 2019-01-26 20:14

Go to..

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

and press checkConnection button for test

查看更多
萌系小妹纸
6楼-- · 2019-01-26 20:20

Go To: File --> Setting --> Build, Execution, Deployment --> Gradle, then tick the use local Gradle distribution, then set Gradle home by giving path to Gradle. Tick offline work.

Like so:

查看更多
干净又极端
7楼-- · 2019-01-26 20:26

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

查看更多
登录 后发表回答