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

AndroidAndroid StudioKotlinGradleAndroid Gradle-Plugin

Android Problem Overview


After updating to Android Studio 4 I got this error: A problem occurred configuring project ':app'. > groovy.lang.MissingPropertyException: No such property: scope for class: com.android.build.gradle.internal.variant.ApplicationVariantData

My gradle:

classpath 'com.android.tools.build:gradle:4.1.0-alpha10'

gradle-wrapper.properties:

https://services.gradle.org/distributions/gradle-6.5-bin.zip

Android Solutions


Solution 1 - Android

I had the same issue. Removing all fabric references in build.gradle solved my case.

you can try to remove

apply plugin: 'io.fabric'

and

classpath 'io.fabric.tools:gradle:1.31.2'

lines from your build.gradle file.

Fabrics Crashlytics deprecated. If you are using Fabric Crashlytics you can replace it with Firebase Crashlytics.

Solution 2 - Android

I had the same problem, in particular with the the same stack trace as @display name (on the comments).

From there I noticed the reference to Crashlytics. And effectively that was the issue: the old, deprecated, version (from Fabric). Migrating to the new Firebase Crashlytics fixed the issue for me.

Solution 3 - Android

Update in OCTOBER 2020 : Fabric is deprecated, so remove all plugins and dependencies depend on Fabric.io

like :

apply plugin: 'io.fabric'


classpath 'io.fabric.tools:gradle:1.31.2'



maven {
        url 'https://maven.fabric.io/public'
    }

and after deletaion you must add :

 classpath 'com.google.firebase:firebase-crashlytics-gradle:2.3.0'

in your build.gradle.

https://firebase.google.com/docs/crashlytics/upgrade-sdk?platform=android

Solution 4 - Android

Just remove or comment it out. it works for me.

apply plugin: 'io.fabric'

and

classpath 'io.fabric.tools:gradle:1.+'

from both gradle file.

Solution 5 - Android

Please update your Gradle dependency to:

classpath "com.android.tools.build:gradle:4.0.0"

and in gradle-wrapper.properties

distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip

Solution 6 - Android

This started happening for me when upgrading Android Studio from 4.0.2 to 4.1. Unfortunately, I had to update a branch that still includes fabric, the only way I could get it working was to downgrade android studio and make the fixes and be able to make a new build.

Download old versions here:

Windows: https://android-studio.en.uptodown.com/windows/versions

Mac: https://android-studio.en.uptodown.com/mac/versions

Solution 7 - Android

I am using Fabrics Crashlytics and i got the same error after updating my Android plugin for Gradle to version 4.1:

classpath 'com.android.tools.build:gradle:4.1.0-rc01'

I need to upgrade gradle plugin to upload native debug symbols to Google play console as stated in this link. https://developer.android.com/studio/preview/features#native-crash-symbolization

To use Android plugin for gradle version 4.1, your minimum gradle version needs to be version 6.5. I used gradle version 6.5.1

distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-all.zip

Upgrading from Fabric Crashlytics to Firebase Crashlytics solved the issue for me, this could be because fabric is not compatible with the newer versions of Android plugin for gradle. For more information on how to upgrade from Fabric crashlytics to Firebase Crashlytics. Check out this link https://firebase.google.com/docs/crashlytics/upgrade-sdk?platform=android

Solution 8 - Android

If you are using com.google.firebase:firebase-crashlytics-gradle dependency in your project, just update to version 2.0.0-beta04 it is helped to me.

Solution 9 - Android

Remove all that connected with deprecated library such as fabric crashlytics etc.

Solution 10 - Android

Updating dependencies in build.gradle (Project level) solved my issue:

        classpath 'com.android.tools.build:gradle:4.1.2'
        classpath 'com.google.gms:google-services:4.3.5'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.5.0'

Solution 11 - Android

I updated the de.mannodermaus.gradle.plugins:android-junit5 to the latest version

Solution 12 - Android

I run into this problem with an older project which I was maintaining after a longer period. Problem was that project was still using older gradle scripts, plugins and dependencies.

The biggest problem was fabric.io which is not maintained and compatible with the latest gradle version. Stack trace in build output which contained crashlytics references pointed me to the fabric. I recommend checking it. In your case, it might be related to other plugins.

Stack trace example:

at com.crashlytics.tools.gradle.ProjectVariantState$deriveFrom.call(Unknown Source)
at com.crashlytics.tools.gradle.CrashlyticsPlugin.createTaskBuilder(CrashlyticsPlugin.groovy:301)
at com.crashlytics.tools.gradle.CrashlyticsPlugin.this$2$createTaskBuilder(CrashlyticsPlugin.groovy)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at com.crashlytics.tools.gradle.CrashlyticsPlugin.addPluginTasks(CrashlyticsPlugin.groovy:271)

Solution 13 - Android

In Project level build.gradle Just downgrade the version of dependency 'com.android.tools.build:gradle:4.5.0' to your last/lower version was 'com.android.tools.build:gradle:4.0.1' and

In "gradle-wrapper.properties" downgrade the "distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-all.zip" to last/lower version like "distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip" . and sync and run .

Solution 14 - Android

On Android Studio simply open build.gradle (Project) and the IDE should suggest an update to crashlytics, accept that and the error will be gone.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDimaView Question on Stackoverflow
Solution 1 - AndroidycannotView Answer on Stackoverflow
Solution 2 - AndroidianribasView Answer on Stackoverflow
Solution 3 - AndroidSana EbadiView Answer on Stackoverflow
Solution 4 - AndroidBC TUBEView Answer on Stackoverflow
Solution 5 - AndroidMaxView Answer on Stackoverflow
Solution 6 - Androidjust_userView Answer on Stackoverflow
Solution 7 - AndroidAhmed SulaimanView Answer on Stackoverflow
Solution 8 - AndroidPavel DolbikView Answer on Stackoverflow
Solution 9 - AndroidlatifalbrView Answer on Stackoverflow
Solution 10 - AndroidPrashanthView Answer on Stackoverflow
Solution 11 - AndroidBoyView Answer on Stackoverflow
Solution 12 - AndroidMichal Zhradnk Nono3551View Answer on Stackoverflow
Solution 13 - AndroidShavneet GrewalView Answer on Stackoverflow
Solution 14 - Androidpaul-2011View Answer on Stackoverflow