AndroidStudio3.2新建项目或者打开项目报错

一般是下载gradle失败导致,明明有梯子不知道为什么总是下载失败

最后换了国内的代理解决

修改build.gradle文件

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

buildscript {
    
    repositories {
        // maven库
        def cn = "http://maven.aliyun.com/nexus/content/groups/public/"
        def abroad = "http://central.maven.org/maven2/"
        // 先从url中下载jar若没有找到,则在artifactUrls中寻找
        maven {
            url cn
            artifactUrls abroad
        }
        maven { url "http://maven.aliyun.com/nexus/content/repositories/jcenter"}
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        

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

allprojects {
    repositories {
        // maven库
        def cn = "http://maven.aliyun.com/nexus/content/groups/public/"
        def abroad = "http://central.maven.org/maven2/"
        // 先从url中下载jar若没有找到,则在artifactUrls中寻找
        maven {
            url cn
            artifactUrls abroad
        }
        maven { url "http://maven.aliyun.com/nexus/content/repositories/jcenter"}
        google()
        jcenter()
    }
}

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

 

posted on 2019-01-04 15:50  沉沦Meteor  阅读(732)  评论(0)    收藏  举报

导航