Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why am I getting AbstractDynamicObject$CustomMessageMissingMethodException error?

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.

What may be causing this?

Full stack trace:

    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) 
like image 916
CodingChap Avatar asked May 12 '21 01:05

CodingChap


2 Answers

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' 

Change it to

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.

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 Plugin 4.2.0 Gradle 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' 
like image 161
RRiVEN Avatar answered Oct 18 '22 09:10

RRiVEN


Update : Google has just fixed the problem in version 4.3.8 (Release Notes)

An updated version of the google-services plugin for Android (v4.3.8) is now available. For more information, see the Firebase Android SDK Release Notes.


The error came from classpath 'com.google.gms:google-services:4.3.6'

The easiest solution :

Go back to version 4.3.5

dependencies {         classpath 'com.google.gms:google-services:4.3.5' } 

Instead of 4.3.6

dependencies {         classpath 'com.google.gms:google-services:4.3.6' } 

In fact, version 4.3.6 is responsible for this error. The easiest way is to go back to the previous version until it is fixed

like image 38
Kabirou Agouda Avatar answered Oct 18 '22 09:10

Kabirou Agouda