Error:Unknown host services.gradle.org. You may need to adjust the proxy settings in Gradle

后端 未结 16 2306
有刺的猬
有刺的猬 2020-12-15 08:38

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

16条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-15 08:44

    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

提交回复
热议问题