Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash: java.lang.AbstractMethodError in com.google.firebase.installations.remote.FirebaseInstallationServiceClient.readGenerateAuthTokenResponse #3507

Closed
omarkilani opened this issue Mar 5, 2022 · 15 comments

Comments

@omarkilani
Copy link

omarkilani commented Mar 5, 2022

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: Bumblebee 2021.1.1 Patch 2
  • Firebase Component: Cloud Messaging
  • Component version: 23.0.0

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

We rebuilt our app to remove the android.permission.ACCESS_BACKGROUND_LOCATION permission.

Ever since then, we see the following crash in the Play Console:

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)

Across hundreds of different devices/OS versions/etc.

It's possible that rebuilding the app picked up some updated dependencies somewhere along the way.

No one on our team can reproduce these crashes, across multiple devices/OS versions/etc. Since we can't get a repro, and the crash is in a Google library, we're not sure what steps to take next. We've just been trying different build tool versions, compile SDKs, etc etc.

We don't see the crashes in the Play Console pre-launch. We don't see the crashes on Firebase Test Lab with the following configurations:

Oriole, API Level 31
Pixel 5e, API Level 30
Pixel 4, API Level 29
Pixel 3, API Level 28
Nexus 5, Virtual, API Level 19

Our configuration was (when our app worked without crashes):

Build Tools: 30.0.2
Min SDK: 16
Target SDK: 30
Compile SDK: 30

Dependencies:

com.google.android.gms:play-services-auth:17.+
com.google.firebase:firebase-messaging:20.+

We rebuilt the app with the exact same dependencies etc, but it's possible something changed in the dependency tree.

We've since updated all the dependencies to the latest versions, so our build looks like:

Build Tools: 32.0.0
Min SDK: 19
Target SDK: 30
Compile SDK: 31

Dependencies:

com.google.android.gms:play-services-auth:20.+
com.google.firebase:firebase-messaging:23.+

We still see the crash in Play Console.

Please... help.

Relevant Code:

      FirebaseMessaging.getInstance().getToken().addOnCompleteListener(task -> {
        if (!task.isSuccessful()) {
          return;
        }

        String token = task.getResult();

        registerWithC2DMServer(token);
      });
@google-oss-bot
Copy link
Contributor

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

@argzdev
Copy link
Contributor

argzdev commented Mar 7, 2022

Hi @omarkilani, thanks for reporting. Are you also using other Firebase products?

Since AbstractMethodError pertains to methods being called without actual implementation. This happens after some library is upgraded while some is not, so some dependencies are missing somehow.

In that case, could you try using BoM version instead of individual versions for each Firebase product, and see if that fixes the issue?

Relevant code:

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

Thanks!

@omarkilani
Copy link
Author

Hi @argzdev,

We don't use any other Firebase products. The only Firebase dep is:

implementation 'com.google.firebase:firebase-messaging:23.0.0'

The only other thing we do is disable analytics in the manifest:

        <meta-data
            android:name="firebase_analytics_collection_deactivated"
            android:value="true"/>

We'll try the BOM way, but... is it weird that the exception isn't reproducible?

I can't map the line number in the exception to the line number in the GitHub repo so it's hard to tell exactly where it's crashing.

@omarkilani
Copy link
Author

omarkilani commented Mar 7, 2022

@argzdev I've pushed a new version of the app (com.rememberthemilk.MobileRTM / 40519) with the BOM change.

diff --git a/android/build.gradle b/android/build.gradle
index 1d01c534..11ad97a2 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -19,8 +19,8 @@ android {
         applicationId "com.rememberthemilk.MobileRTM"
         minSdkVersion 19
         targetSdkVersion 30
-        versionCode 40518  // Min API level 19, v4.5.15+
-        versionName "4.5.18"
+        versionCode 40519  // Min API level 19, v4.5.15+
+        versionName "4.5.19"
     }
 
                lint {
@@ -109,7 +109,8 @@ dependencies {
   implementation 'com.google.android.gms:play-services-auth:20.+'
   implementation 'com.google.android.gms:play-services-location:19.+'
   implementation 'com.google.android.gms:play-services-maps:18.+'
-  implementation 'com.google.firebase:firebase-messaging:23.0.0'
+  implementation platform('com.google.firebase:firebase-bom:29.1.0')
+  implementation 'com.google.firebase:firebase-messaging'
   implementation 'androidx.legacy:legacy-support-v4:1.0.+'
   implementation 'androidx.media:media:1.5.+'
   implementation 'androidx.appcompat:appcompat:1.4.+'

Since we can't repro it, we basically just have to deploy to users and see the crash data in Play Console.

Will keep you updated.

@argzdev
Copy link
Contributor

argzdev commented Mar 7, 2022

Thanks for the update, @omarkilani.

That is an odd issue. For what it's worth, you could try cleaning or rebuilding your app before creating a new version of the app. I hope the changing the BoM version helps.

For now, let's keep this ticket open until you have some update, and in case our engineers might have an idea what the issue is. Feel free to add any questions or extra information. Thanks!

@omarkilani
Copy link
Author

@argzdev thanks for the response.

The app is always built from a clean checkout, and always with "clean" passed to Gradle on the command line.

@argzdev
Copy link
Contributor

argzdev commented Mar 7, 2022

This makes the issue all the more odd. But anyhow, let's keep this open for now. Thanks for confirming!

@omarkilani
Copy link
Author

omarkilani commented Mar 7, 2022

@argzdev still waiting on Play Store to approve the update, but...

It seems like maybe... the crashing users are going down a different code path than us?

Maybe their token request is failing in some way?

Is there any way for you guys to check like... any changes to the FCM endpoints since Feb 22?

And maybe aggregate crashes in the FCM code across apps?

@omarkilani
Copy link
Author

@argzdev

4.5.19 still crashes, so I'm not sure what to do next.

Crash
Samsung Galaxy Note10+
Android 11 (SDK 30)
40519.aab
15 minutes ago

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:923)
Crash
Motorola moto g power
Android 11 (SDK 30)
40519.aab
16 minutes ago

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:923)

Etc.

@omarkilani
Copy link
Author

omarkilani commented Mar 7, 2022

FWIW, this is what the Play Console looks like for this crash.

Screen Shot 2022-03-07 at 3 50 08 PM

We still can't repro.

One of our users sent the unmapped crash, which looks like:

Screen_Shot_2022-03-07_at_20 40 22

I'm not really sure which method it's referencing here, because:

Screen_Shot_2022-03-07_at_20 41 23 (1)

None of these have an int param. I guess it's setResponseCode, but... why isn't it a 100% repro? That's the part that just doesn't make sense?

I thought maybe dex2oat was the cause, but it ran on my Pixel 2 XL and the app didn't crash. I also bought a new Nokia G20/Android One phone running 11 and that also ran dex2oat with no issues.

@omarkilani
Copy link
Author

Just a random observation but...

c374dbe

Bumps deps on play services ~Feb 14, and we rebuilt on Feb 22... probably a coincidence...?

@omarkilani
Copy link
Author

One thing I forgot to mention in the initial post is that we use/have used R8 fullMode:

android.enableR8.fullMode=true

@omarkilani
Copy link
Author

omarkilani commented Mar 8, 2022

We've made the following change to our proguard config:

@@ -137,3 +137,11 @@
+
+-keep class com.google.firebase.installations.** {
+  *;
+}
+
+-keep interface com.google.firebase.installations.** {
+  *;
+}

And are now testing this change on the installed base of the app (version 4.5.20 / versionCode 40520).

@omarkilani
Copy link
Author

@argzdev the proguard rules in #3507 (comment) seem to have resolved these crashes.

It's not really clear why they're needed now, but maybe this is useful information for... someone?

Thanks!

@argzdev
Copy link
Contributor

argzdev commented Mar 8, 2022

Hi @omarkilani, thanks for the updates! I'm sure these details would be useful in the future, and I'm glad you were able to resolve it.

Great catch on the R8, there are also other different Firebase products such as Analytics, Performance which had issues on R8 when fullMode is enabled. I guess this is also one of those cases.

Anyhow, since this issue has been resolved, I'll close this for now. Feel free to add any extra details! Thanks!

@argzdev argzdev closed this as completed Mar 8, 2022
@firebase firebase locked and limited conversation to collaborators Apr 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants