Gradle in Android Studio: Failed to resolve third-party libraries

后端 未结 7 2259
陌清茗
陌清茗 2020-12-09 10:51

I have been trying to switch my project from Intellij to Android Studio, which has required me to create a build.gradle file. I know I can add each of these as a library dep

7条回答
  •  有刺的猬
    2020-12-09 11:15

    If you use VPN | Proxy on your system then use your proxy info in the gradle.properties file in your project like the following lines of code:

    # HTTP Proxy
    systemProp.http.proxyHost={Host Address}
    systemProp.http.proxyPort={Port Number}
    systemProp.http.proxyUser={Proxy Username}
    systemProp.http.proxyPassword={Proxy Password}
    systemProp.http.nonProxyHosts={NonProxy Hosts Address} # like: 127.0.0.1,localhost
    
    # HTTPS Proxy
    systemProp.https.proxyHost={Host Address}
    systemProp.https.proxyPort={Port Number}
    systemProp.https.proxyUser={Proxy Username}
    systemProp.https.proxyPassword={Proxy Password}
    systemProp.https.nonProxyHosts={NonProxy Hosts Address} # like: 127.0.0.1,localhost
    

    Now just replace {.....} in the above code with appropriate data


    Also you can set Android studio proxies like the following image by your proxy info in File>Settings:

    Now test again...!

提交回复
热议问题