解決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"}
    }
}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章