问题描述
我刚开始一个新项目,并试图连接到Firebase.
一旦我尝试构建我的项目,我就会收到错误消息:无法解析Android应用程序模块的Gradle Config,因此我查看了我的构建,该构建告诉我jCenter()已过时,应该删除它.当我删除它时,一切正常.但是,当我尝试连接到Firebase时,出现错误:AbstractDynamicObject $ CustomMessageMissingMethodException.
I have just started a new project and am trying to connect to Firebase.
As soon as I try to build my project I got the error :Could not parse the Android application Module's Gradle Config, so I looked in my build which told me that jCenter() was deprecated and that I should remove it. When I removed it, everything worked fine. However, when I tried to connect to Firebase I got the error: AbstractDynamicObject$CustomMessageMissingMethodException.
可能是什么原因造成的?
完整堆栈跟踪:
Caused by: java.lang.RuntimeException: com.android.build.gradle.internal.crash.ExternalApiUsageException: org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException: Could not find method setVariantDir() for arguments [debug] on task ':app:processDebugGoogleServices' of type com.google.gms.googleservices.GoogleServicesTask.
at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:71)
at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:54)
at com.android.build.gradle.internal.profile.AnalyticsResourceManager.recordBlockAtConfiguration(AnalyticsResourceManager.kt:206)
at com.android.build.gradle.internal.profile.AnalyticsConfiguratorService.recordBlock(AnalyticsConfiguratorService.kt:85)
at com.android.build.gradle.internal.plugins.BasePlugin.lambda$createTasks$9(BasePlugin.java:582)
at com.android.build.gradle.internal.crash.CrashReporting$afterEvaluate$1.execute(crash_reporting.kt:37)
at com.android.build.gradle.internal.crash.CrashReporting$afterEvaluate$1.execute(crash_reporting.kt)
谢谢!
推荐答案
我来这里是因为遇到同样的错误.幸运的是,发生这种情况时,我正在更新依赖项,并将其范围缩小到:
I came here because I am getting the same error. Luckily I was updating dependencies when it happened and narrowed it down to:
classpath 'com.google.gms:google-services:4.3.6'
将其更改为
classpath 'com.google.gms:google-services:4.3.5'
对我来说,错误消失了.希望也能为您
The error goes away for me. Hopefully for you too
有关我的依存关系的更多信息.
Here is more info on my dependencies.
运行Android Studio 4.2版本2021年4月28日
Running Android Studio 4.2 build April 28 2021
repositories {
google()
mavenCentral()
maven { url 'https://plugins.gradle.org/m2/'}
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.0'
classpath 'com.google.gms:google-services:4.3.5'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.6.0'
classpath 'com.google.firebase:perf-plugin:1.4.0'
Gradle插件4.2.0摇篮7.0.1
Gradle Plugin 4.2.0Gradle 7.0.1
//Firebase
implementation 'com.google.firebase:firebase-ads:20.1.0'
implementation 'com.google.firebase:firebase-core:19.0.0'
implementation 'com.google.firebase:firebase-crash:16.2.1'
implementation 'com.google.firebase:firebase-messaging:22.0.0'
implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
implementation 'com.google.firebase:firebase-auth:21.0.0'
implementation 'com.google.firebase:firebase-firestore:23.0.0'
这篇关于为什么会出现AbstractDynamicObject $ CustomMessageMissingMethodException错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!