解决Unknown host 'jcenter.bintray.com'. You may need to adjust the proxy setting

有时候从GitHub上下的项目加载老半天依赖下不下来,主要报以下错误

Unknown host 'jcenter.bintray.com'. You may need to adjust the proxy settings in Gradle.
Enable Gradle 'offline mode' and sync project
Learn about configuring HTTP proxies in Gradle

或者如下错误

ERROR: Failed to resolve: com.google.guava:guava:27.0.0-android
Show in Project Structure dialog
Affected Modules: app

解决办法只要在项目项目build.gradle文件中添加maven { url"https://jitpack.io"}即可

buildscript {
    repositories {
        google()
        jcenter()
        maven {url"https://jitpack.io"}
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven {url"https://jitpack.io"}
    }
}

 

你可能感兴趣的:(android)