Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 734
IvanFdz Avatar asked Dec 13 '25 06:12

IvanFdz


1 Answers

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.+'
}
like image 121
IvanFdz Avatar answered Dec 15 '25 18:12

IvanFdz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!