demol
demol

Reputation: 1

Error(3,0) Gradle DSL method not found: 'buildToolsVersion()'

Please I am a beginner in Android development. I just tried to run my first code in line with the tutorial I am using to learn. I got this error:

Gradle DSL method not found: 'buildToolsVersion()'

This is my build.gradle(Project:HappyBirthday)

// Top-level build file where you can add configuration options common to all sub-projects/modules.

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

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

And this is my build.gradle(Module:app)

apply plugin: 'com.android.application'

           buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "com.example.android.happybirthday"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    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'

}

Upvotes: 0

Views: 488

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006674

You seem to be missing the android closure and your compileSdkVersion line. Change your second file to look like this:

apply plugin: 'com.android.application'

android {

    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "com.example.android.happybirthday"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    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'

}

Upvotes: 1

Related Questions