未指定构建工具版本

时间:2016-07-07 16:16:23

标签: javascript android android-studio

当我将项目与gradle文件同步时,我有这个问题, 错误:原因:未指定buildToolsVersion。

这是build.gradle项目

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "com.example.natalia.ministerioproyecto"
        minSdkVersion 10
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    sourceSets
            {
                main
                        {
                            res.srcDirs =
                                    [
                                            '/src/main/res/layout/Polo azul/Formulario Dinara'
                                    ]
                        }
            }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.4.0'
    classpath 'com.android.support:appcompat-v7:23.4.0'
}

和thi是模块:app

apply plugin:'com.android.application'

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


        }
    }


    allprojects {
        repositories {
            jcenter()

        }
    }

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

1 个答案:

答案 0 :(得分:0)

Gradle文件错误。

build.gradle项目

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


    }
}


allprojects {
    repositories {
        jcenter()

    }
}

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

<强>模块:应用

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "com.example.natalia.ministerioproyecto"
        minSdkVersion 10
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    sourceSets
            {
                main
                        {
                            res.srcDirs =
                                    [
                                            '/src/main/res/layout/Polo azul/Formulario Dinara'
                                    ]
                        }
            }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.4.0'
    classpath 'com.android.support:appcompat-v7:23.4.0'
}