AndroidStudio新建项目报错build failed
老眼 2019-02-16 23:33:48
分 享


问题现象


点击 make project 后build failed


解决方法


把项目的build.gradle 里的buildscript 和allprojects 改成下面的配置


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()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'


       // 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()
}
}


吐槽一下

游客

所有吐槽
  • 暂时还没有吐槽,赶紧来吐槽!