IvanFdz
IvanFdz

Reputation: 61

Gradle Error "Cannot invoke method buildToolsVersion() on null object"

I need some help...

I'm getting this error when trying to build android .apk:

FAILURE: Build Failed with an exception. "Cannot invoke method buildToolsVersion() on null object"

I'm building on windows via cmd.exe with command: gradle build from gonative.io source code.

And this is my build.gradle file:

apply plugin: 'android'

android {
compileSdkVersion 21    buildToolsVersion "21.1.2"

defaultConfig {
    minSdkVersion 14
    targetSdkVersion 21
    applicationId "io.gonative.android.xeeyk"
    versionCode 13
}

signingConfigs {
    release {
        storeFile file("../../release.keystore")
        storePassword "password"
        keyAlias "release"
        keyPassword "password"
    }
}

buildTypes {
    debug {
    applicationIdSuffix ".debug"
    }
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'),     'proguard-project.txt'
        zipAlignEnabled true
        signingConfig signingConfigs.release
        }
    }
}

dependencies {
compile 'com.android.support:support-v4:21.+'
compile 'com.android.support:appcompat-v7:21.0.+'
compile 'com.google.android.gms:play-services:6.1.+'
}

Can someone help me? Thanks in advance for any assistance, Ivan

Upvotes: 3

Views: 5496

Answers (1)

IvanFdz
IvanFdz

Reputation: 61

CommonsWare answer do the trick. Moved buildToolsVersion to de next line solved de problem. Sorry Mark, it really was a super noob question. This should be the build.gradle file:

apply plugin: 'android'

android {
compileSdkVersion 21    
buildToolsVersion "21.1.2"

defaultConfig {
minSdkVersion 14
targetSdkVersion 21
applicationId "io.gonative.android.xeeyk"
versionCode 13
}

signingConfigs {
release {
    storeFile file("../../release.keystore")
    storePassword "password"
    keyAlias "release"
    keyPassword "password"
    }
}

buildTypes {
debug {
applicationIdSuffix ".debug"
}
release {
    minifyEnabled true
    proguardFiles getDefaultProguardFile('proguard-android.txt'),     'proguard-project.txt'
    zipAlignEnabled true
    signingConfig signingConfigs.release
        }
    }
}

dependencies {
compile 'com.android.support:support-v4:21.+'
compile 'com.android.support:appcompat-v7:21.0.+'
compile 'com.google.android.gms:play-services:6.1.+'
}

Upvotes: 3

Related Questions