Gradle Error "Unable to call buildToolsVersion () method for null object"

I need help...

I am getting this error when trying to build android .apk

:

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

      

I am creating 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 anyone help me? Thanks in advance for any help Ivan

+3


source to share


1 answer


CommonsWare's answer does the trick. Moved buildToolsVersion

to next line resolving the issue. Sorry Mark, that really was a super noob question. This should be your 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.+'
}

      

+2


source







All Articles