Saurabh kumar
Saurabh kumar

Reputation: 51

Gradle Build Error Could not get unknown property supportVersion

Error Message:

Could not get unknown property 'supportVersion' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

Build.gradle Codes:-

apply plugin:'com.android.application'

android {

    compileSdkVersion 25

    buildToolsVersion '27.0.3'

    defaultConfig {

        applicationId "com.eassycars.www.dlservices"

        minSdkVersion 16

        targetSdkVersion 25

        versionCode 1

        versionName "1.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }

    buildTypes {

        release {

            minifyEnabled false

            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

        }

    }

}

dependencies {

    compile fileTree(include: ['*.jar'], dir: 'libs')

// google & support

 implementation "com.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler :$supportVersion"

    implementation "com.android.support:appcompat-v7:$supportVersion"

    implementation "com.android.support:cardview-v7:$supportVersion"

    implementation "com.android.support:recyclerview-v7:$supportVersion"

    implementation "com.android.support:design:$supportVersion"

    implementation "com.android.support:palette-v7:$supportVersion"

    implementation "com.android.support:customtabs:$supportVersion"

    implementation "com.android.support:support-v4:$supportVersion"

    implementation 'com.google.android.exoplayer:exoplayer:r2.0.4'
// utils

    implementation 'com.github.bumptech.glide:glide:4.0.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0'

    implementation 'com.koushikdutta.ion:ion:2.1.7'

    implementation 'com.github.Commit451:bypasses:1.0.4'

    implementation 'com.jakewharton:butterknife:8.8.0'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.0'

    implementation 'com.drewnoakes:metadata-extractor:2.9.1'

    implementation "com.orhanobut:hawk:2.0.1"

    classpath 'com.google.gms:google-services:3.1.1'

    compile 'com.android.support:support-annotations:27.1.1'
}

Can Anyone tell me that how to fix this error

Upvotes: 1

Views: 15914

Answers (2)

Rajasekaran M
Rajasekaran M

Reputation: 2538

you need to add above android{} on your gradle

ext {
supportVersion='27.1.1'
}

Upvotes: 3

piy26
piy26

Reputation: 1592

The error tells that there is no value for the variable $supportVersion. If you know exactly what version you would like to use then define supportVersion like you have defined buildToolsVersion. I am not sure but its the same for your case.

buildToolsVersion '27.0.3'
supportVersion '27.0.3'

Or replace supportVersion with buildToolsVersion in your existing file.

Upvotes: 2

Related Questions