zoukankan      html  css  js  c++  java
  • AndroidStudio新建项目报错build failed

    AndroidStudio新建项目报错build failed

    报错信息

    org.gradle.initialization.ReportedException: org.gradle.internal.exceptions.LocationAwareException: A problem occurred configuring root project 'Test1'.
    
    Caused by: org.gradle.internal.exceptions.LocationAwareException: A problem occurred configuring root project 'Test1'
    
    Caused by: org.gradle.internal.exceptions.LocationAwareException: A problem occurred configuring root project 'Test1'

    这里写图片描述

    解决方法

    把项目的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()
        }
    }
  • 相关阅读:
    android 多线程
    Uva 10881 Piotr’s Ants 蚂蚁
    LA 3708 Graveyard 墓地雕塑 NEERC 2006
    UVa 11300 Spreading the Wealth 分金币
    UVa 11729 Commando War 突击战
    UVa 11292 The Dragon of Loowater 勇者斗恶龙
    HDU 4162 Shape Number
    HDU 1869 六度分离
    HDU 1041 Computer Transformation
    利用可变参数函数清空多个数组
  • 原文地址:https://www.cnblogs.com/qq874455953/p/9901066.html
Copyright © 2011-2022 走看看