Can't resolve dependency in Android Studio with jcenter

前端 未结 3 851
离开以前
离开以前 2021-02-06 11:06

Why my program hang on resolving dependency for appDebug in andorid studio? I can\'t resolve any library.

This is my root gradle file:

buildscript {
rep         


        
3条回答
  •  走了就别回头了
    2021-02-06 11:41

    After one day time wasting i found that it's gift for Iranian developer :D

    Finally i switch back to mavenCentral().by changing to mavenCentral() in my root gradle . and problem solved.

    My root build.gradle file turn to below code:

    buildscript {
    repositories {
    
       mavenCentral()
    
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'
    }
    }
    
    allprojects {
    repositories {
        mavenCentral()
    }
    }
    

    Some library don't exist in mevenCentral so we have to add proxy to our gradle.properties file like below to access jcenter :D

    systemProp.http.proxyHost=www.somehost.org
    systemProp.http.proxyPort=8080
    systemProp.http.proxyUser=user
    systemProp.http.proxyPassword=password
    systemProp.http.nonProxyHosts=localhost
    systemProp.http.auth.ntlm.domain=domain
    

    Or for https

    systemProp.https.proxyHost=www.somehost.org
    systemProp.https.proxyPort=8080
    systemProp.https.proxyUser=user
    systemProp.https.proxyPassword=password
    systemProp.https.nonProxyHosts=localhost
    systemProp.https.auth.ntlm.domain=domain
    

提交回复
热议问题