gpt4 book ai didi

Android Studio 4.1 金丝雀 : Firebase Crashlytics breaks android project compilation

转载 作者:行者123 更新时间:2023-12-03 13:25:40 29 4
gpt4 key购买 nike

更新:这已在 Crashlytics Gradle plugin version 2.0.0-beta04 中修复.

一直试图从我正在处理的项目中删除即将弃用的 Fabric Crashlytics SDK,以支持新的 Firebase Crashlytics SDK。不幸的是,我在之后编译时遇到了麻烦。我不断收到以下异常:
Gradle sync failed: No such property: scope for class: com.android.build.gradle.internal.variant.ApplicationVariantData
这是堆栈跟踪:

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

我的 build.gradle (app) 文件:
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'
}

有谁知道这个问题的解决方案?

最佳答案

这现在在 Crashlytics Gradle 插件版本 2.0.0-beta04 中得到修复。

所以升级项目build.gradle文件:

...
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"
}
...

关于Android Studio 4.1 金丝雀 : Firebase Crashlytics breaks android project compilation,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60748645/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com