'java.lang.AbstractMethodError in Firebase Android (FirebaseInstallationServiceClient.readGenerateAuthTokenResponse)

We have this crash that in Play Console has occurred some 1.1million times and counting, with no success figuring out why.

The report:

java.lang.AbstractMethodError: 
  at com.google.firebase.installations.remote.FirebaseInstallationServiceClient.readGenerateAuthTokenResponse (FirebaseInstallationServiceClient.java:569)
  at com.google.firebase.installations.remote.FirebaseInstallationServiceClient.generateAuthToken (FirebaseInstallationServiceClient.java:421)
  at com.google.firebase.installations.FirebaseInstallations.fetchAuthTokenFromServer (FirebaseInstallations.java:566)
  at com.google.firebase.installations.FirebaseInstallations.doNetworkCallIfNecessary (FirebaseInstallations.java:390)
  at com.google.firebase.installations.FirebaseInstallations.lambda$doRegistrationOrRefresh$2 (FirebaseInstallations.java:377)
  at com.google.firebase.installations.FirebaseInstallations.$r8$lambda$VZq1h0TBcWNH8Y5yY86ujrFFyLo (FirebaseInstallations.java)
  at com.google.firebase.installations.FirebaseInstallations$$InternalSyntheticLambda$0$8f6250a76dc84afdee54bd79d6c6b27858a3db00ee2f9ff4dae9d6825fe4cbe4$0.run$bridge (FirebaseInstallations.java:18)
  at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1167)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:641)
  at java.lang.Thread.run (Thread.java:920)

There's little more we have to work with...it is seemingly entirely contained in the Firebase SDK.

The crash is not reproducible by anyone on team and none of the pre-launch test devices exhibit any issue or any mass device testing service. Firebase Messaging appears to be working fine in any manner we can test.

We were on

com.google.firebase:firebase-messaging:20.x.x

So we updated to

com.google.firebase:firebase-messaging:23.0.0

Nothing changed, the crash is still pouring in every hour.

One prior update to that we removed permission: android.permission.ACCESS_BACKGROUND_LOCATION to be compliant with that recent change. However it was a relic and the app has not actually required it for years.

This is seemingly when the crash began, though as far as I'm aware, Firebase SDK doesn't need this permission and hasn't needed it but we're grasping at straws.

Some build vars:

minSdkVersion 19
targetSdkVersion 30
compileSdkVersion 30
buildToolsVersion 32.0.0
Gradle 7.1.2

android.enableJetifier=true
android.enableR8=true
android.enableR8.fullMode=true
android.useAndroidX=true

It feels like a build problem, as our code base changed very little (a single manifest perm line before attempting the Firebase SDK update)...but we're just not having much luck and the variance in not every one encountering it, is peculiar.



Solution 1:[1]

In the event this helps a single person avoid the pain we endured. Our solution was adding this to proguard:

-keepattributes AutoValue

-keep class com.google.firebase.installations.** {
  *;
}

-keep interface com.google.firebase.installations.** {
  *;
}

And changing our depend to:

implementation platform('com.google.firebase:firebase-bom:29.1.0')
implementation 'com.google.firebase:firebase-messaging'

We are not entirely clear on why this became necessary.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 RandomIO