UPDATE: This is fixed in Crashlytics Gradle plugin version 2.0.0-beta04.
Been trying to remove the soon to be deprecated Fabric Crashlytics SDK from the project I'm working on in favour of the new Firebase Crashlytics SDK. Unfortunately I'm having trouble compiling afterwards. I keep getting the following exception:
Gradle sync failed: No such property: scope for class: com.android.build.gradle.internal.variant.ApplicationVariantData
Here's the stacktrace:
Caused by: groovy.lang.MissingPropertyException: No such property: scope for class: com.android.build.gradle.internal.variant.ApplicationVariantData
at com.google.firebase.crashlytics.buildtools.gradle.CrashlyticsPlugin.configureTaskDependencies(CrashlyticsPlugin.groovy:199)
at com.google.firebase.crashlytics.buildtools.gradle.CrashlyticsPlugin.configureUploadTask(CrashlyticsPlugin.groovy:187)
at com.google.firebase.crashlytics.buildtools.gradle.CrashlyticsPlugin.registerMappingFileTasks(CrashlyticsPlugin.groovy:142)
at com.google.firebase.crashlytics.buildtools.gradle.CrashlyticsPlugin$registerMappingFileTasks.callCurrent(Unknown Source)
at com.google.firebase.crashlytics.buildtools.gradle.CrashlyticsPlugin.registerCrashlyticsTasks(CrashlyticsPlugin.groovy:101)
at org.gradle.internal.metaobject.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:483)
at org.gradle.internal.metaobject.BeanDynamicObject.tryInvokeMethod(BeanDynamicObject.java:195)
at org.gradle.internal.metaobject.ConfigureDelegate.invokeMethod(ConfigureDelegate.java:77)
at com.google.firebase.crashlytics.buildtools.gradle.CrashlyticsPlugin$_apply_closure3.doCall(CrashlyticsPlugin.groovy:71)
at org.gradle.util.ClosureBackedAction.execute(ClosureBackedAction.java:71)
at org.gradle.util.ConfigureUtil.configureTarget(ConfigureUtil.java:154)
at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:105)
at org.gradle.util.ConfigureUtil$WrappedConfigureAction.execute(ConfigureUtil.java:166)
at org.gradle.api.internal.DefaultCollectionCallbackActionDecorator$BuildOperationEmittingAction$1$1.run(DefaultCollectionCallbackActionDecorator.java:100)
at org.gradle.configuration.internal.DefaultUserCodeApplicationContext.reapply(DefaultUserCodeApplicationContext.java:60)
at org.gradle.api.internal.DefaultCollectionCallbackActionDecorator$BuildOperationEmittingAction$1.run(DefaultCollectionCallbackActionDecorator.java:97)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)
at org.gradle.api.internal.DefaultCollectionCallbackActionDecorator$BuildOperationEmittingAction.execute(DefaultCollectionCallbackActionDecorator.java:94)
at org.gradle.internal.ImmutableActionSet$SetWithFewActions.execute(ImmutableActionSet.java:285)
at org.gradle.api.internal.DefaultDomainObjectCollection.doAdd(DefaultDomainObjectCollection.java:264)
at org.gradle.api.internal.DefaultDomainObjectCollection.add(DefaultDomainObjectCollection.java:253)
at com.android.build.gradle.AbstractAppExtension.addVariant(AbstractAppExtension.kt:64)
at com.android.build.gradle.internal.ApiObjectFactory.create(ApiObjectFactory.java:118)
... 144 more
My build.gradle (app) file:
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.stanfy.spoon:spoon-gradle-plugin:1.2.2'
classpath "org.jetbrains.dokka:dokka-android-gradle-plugin:$dokka_version"
}
}
plugins {
id 'com.gladed.androidgitversion' version '0.4.10'
id "com.vanniktech.android.junit.jacoco" version "0.15.0"
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'org.jetbrains.dokka-android'
apply plugin: 'com.google.firebase.crashlytics'
apply from: '../app/checkstyle.gradle'
apply from: '../app/ktlint.gradle'
apply from: '../app/androidgit.gradle'
androidExtensions.experimental = true
android {
compileSdkVersion 29
defaultConfig {
applicationId "com.example"
minSdkVersion 22
targetSdkVersion 29
versionName androidGitVersion.name()
versionCode androidGitVersion.code()
testInstrumentationRunner "com.example.utils.CustomJUnit4TestRunner"
// If set to 'true', enables the instrumentation class to start and stop profiling.
// If set to false (default), profiling occurs the entire time the instrumentation
// class is running.
testHandleProfiling true
// The following argument makes the Android Test Orchestrator run its
// "pm clear" command after each test invocation. This command ensures
// that the app's state is completely cleared between tests.
// testInstrumentationRunnerArguments clearPackageData: 'true'
// The following argument makes LeakCanary run when instrumentationtests run
// testInstrumentationRunnerArgument "listener", "leakcanary.FailTestOnLeakRunListener"
// Upon compilation, export our Room database schema into a JSON file. These represent
// our database's schema history and are used for database migration testing
// used by Room, to test migrations
javaCompileOptions {
annotationProcessorOptions {
arguments = [
"room.schemaLocation": "$projectDir/schemas".toString(),
"room.incremental":"true"
// "room.expandProjection":"true"
]
}
}
}
buildFeatures {
viewBinding = true
}
buildTypes {
debug {
testCoverageEnabled false
}
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true
// Sets Java compatibility to Java 8
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
...
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
...
// Crashlytics dependencies
implementation platform("com.google.firebase:firebase-bom:$firebase_bom_version")
implementation 'com.google.firebase:firebase-crashlytics'
}
Anyone know the solution to this?
This is now fixed in Crashlytics Gradle plugin version 2.0.0-beta04.
So upgrade the project build.gradle
file with:
...
dependencies {
classpath "com.android.tools.build:gradle:$gradle_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.google.firebase:firebase-crashlytics-gradle:2.0.0-beta04"
}
...