Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No such property: variantConfiguration for class:

After upgrading gradle 4.0.0 app build failed with error message:

No such property: variantConfiguration for class: com.android.build.gradle.internal.variant.ApplicationVariantData

is there any way to migrate gradle ?

android.applicationVariants.all { variant ->
        variant.outputs.all {
            def buildType = variant.variantData.variantConfiguration.buildType.name
            ...

        }
    }

app level gradle file

dependencies {
        classpath 'com.android.tools.build:gradle:4.0.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
like image 524
Vahe Gharibyan Avatar asked May 28 '20 21:05

Vahe Gharibyan


1 Answers

In the last gradle Relase ApplicationVariant implement BaseVariant

Instead of

def buildType = variant.variantData.variantConfiguration.buildType.name

Should be

def buildType = variant.buildType.name
like image 120
Vahe Gharibyan Avatar answered Nov 16 '22 19:11

Vahe Gharibyan