找不到com.android.tools.build:gradle:3.2

问题描述 投票:1回答:2

在我安装Android Studio 2.3并更新了我的SDK之后,the following error就出现了。可以做些什么来解决这个问题?

android android-studio android-gradle
2个回答
2
投票

在build.gradle.project中使用它

//顶级构建文件,您可以在其中添加所有子项目/模块共有的配置选项。

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.1'

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

allprojects {
    repositories {
        jcenter()
    }
}

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

这在build.gradle.module中

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.3"
    defaultConfig {
        applicationId "com.example.madridistansit.mapapplication"
        minSdkVersion 18
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.3.1'
}

0
投票

如果classpath 'com.android.tools.build:gradle:2.3.1'返回classpath错误,请尝试:compile 'com.android.tools.build:gradle:2.3.1'

© www.soinside.com 2019 - 2024. All rights reserved.