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

时间:2017-07-03 14:38:48

标签: android android-studio android-gradle

安装Android Studio 2.3并更新我的SDK后,发生the following error。可以做些什么来解决这个问题?

2 个答案:

答案 0 :(得分: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'
}

答案 1 :(得分:0)

如果classpath 'com.android.tools.build:gradle:2.3.1'返回类路径错误 试试这个:compile 'com.android.tools.build:gradle:2.3.1'