欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

ERROR: Unknown host ‘repo.maven.apache.org: nodename nor servname provided, or not known‘(2020/08)

程序员文章站 2024-01-16 19:52:34
今天想运行一下之前做的项目,结果报错:ERROR: Unknown host 'repo.maven.apache.org: nodename nor servname provided, or not known'. You may need to adjust the proxy settings in Gradle.Enable Gradle 'offline mode' and sync projectLearn about configuring HTTP proxies in G......

 

今天想运行一下之前做的项目,结果报错:

ERROR: Unknown host 'repo.maven.apache.org: nodename nor servname provided, or not known'. 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: Unknown host ‘repo.maven.apache.org: nodename nor servname provided, or not known‘(2020/08)

 

解决方式

build.gradle(Project: xxx),加上阿里镜像

 

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
//        jcenter()
        google()
        mavenCentral()
        jcenter{url "http://jcenter.bintray.com/"}


    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
//        jcenter()
        maven { url "https://jitpack.io" }

        google()
        mavenCentral()
        jcenter{url "http://jcenter.bintray.com/"}
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

 

 

 

 

 

 

 

 

 

 

 

本文地址:https://blog.csdn.net/YuDBL/article/details/108148571