Firebase Messaging on Android suddenly started crashing when message received - android

Currently using react native, react-native-firebase, and react-native-push-notification. Everything was fine until suddenly today firebase messaging started causing the app to crash. The error message is the following:
Process: com.packagename, PID: 30087
java.lang.AbstractMethodError: abstract method "com.google.android.gms.tasks.Task com.google.firebase.iid.WithinAppServiceBinder$IntentHandler.zza(android.content.Intent)"
at com.google.firebase.iid.WithinAppServiceBinder.zza(com.google.firebase:firebase-iid##20.2.2:9)
at com.google.firebase.iid.zzaw.zza(com.google.firebase:firebase-iid##20.2.2:30)
at com.google.firebase.iid.zzaw.onServiceConnected(com.google.firebase:firebase-iid##20.2.2:59)
at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:2067)
at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:2099)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:8016)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1076)
The error occurs when a notification is received, but does not trigger a data message. In addition, the notification is received and processed before causing the crash.
I thought the error might have been caused by changing the react-native-firebase/app version, so I reverted my project on git to that of a previous, working version. However, I still get the same error after cleaning and rebuilding. It also occurs even if there are no notification listeners set up on the react native side, although I'm not sure what that entails for the actual native code. What could possibly be the problem? I'm using versions of react-native-firebase/messaging (7.1.5) and react-native-firebase/app (7.2.0) that were previously functional.

Edit 07/09/2020: We have released firebase-iid and firebase-messaging versions 20.2.3 with a fix for this issue, please upgrade to the latest versions.
[Firebaser here] It looks like yesterday's releases of firebase-messaging and firebase-iid contain a bug which can cause this crash. We are working hard on a fix.
For now the best thing to do is to use the versions released on June 18th:
https://firebase.google.com/support/release-notes/android#2020-06-18
com.google.firebase:firebase-messaging:20.2.1
com.google.firebase:firebase-iid:20.2.1
We are working on a fix and hope to have a new release out soon. When we do I will update this answer and the release notes will be available here:
https://firebase.google.com/support/release-notes/android

We tried adding firebaseMessagingVersion = "20.2.1" into the ext section in the root project android/build.gradle which fixed it for us. We looked into the safeExtGet method and found that it would try to extract the top level variable from the root project file.
By doing it in this way we didn't need to touch the node modules.
ext {
googlePlayServicesVersion = "16.+"
firebaseVersion = "17.3.4"
firebaseMessagingVersion = "20.2.1"
}

Exact same issue with these versions. And yes they were functional before this
"#react-native-firebase/app": "^6.7.1",
"#react-native-firebase/messaging": "^6.7.1",
Issue Solved:
Go to react-native-push-notification/build.gradle
Change
def firebaseVersion = safeExtGet('firebaseVersion', '+')
to
def firebaseVersion = safeExtGet('firebaseVersion', '20.2.1')
It was picking us the version 20.2.2 which is not stable and was causing all kind of weird issues.

This upgrade fixed the issue for me
implementation 'com.google.firebase:firebase-messaging:20.2.3'

This case is working for me:
implementation "com.google.firebase:firebase-messaging:20.2.3"
implementation "com.google.firebase:firebase-analytics:17.4.4"
Ref to github issue

This issue is fixed with latest version of this dependency.
https://firebase.google.com/support/release-notes/android#messaging_v20-2-3

Related

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/iid/FirebaseInstanceId; React Native App

I've been trying to run my react native application, but it crashed when started and the debugger didn't return any error, so I checked the log cat in Android Studio and it shows me the following error: java.lang.NoClassDefFoundError: Failed resolution of: Lcom / google / firebase / iid / FirebaseInstanceId;
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.iid.FirebaseInstanceId"
The React-Native version that I am using is: 0.61.5
And the version of react-native-firebase that I have installed is 5.6.0
It has already been a recent failure, since previously the app worked correctly and I have not made any changes to the firebase integration either
To debug this, first I would suggest running adb logcat and seeing what Java error you are getting. If it errors out on the not being able to find the required Java classes, then try adding the following to your project:
app/build.gradle file (dependencies section):
implementation 'com.google.firebase:firebase-iid'
(You might need to provide a version for this package as well)
I have getting same error, I fixed this error by uninstalling old version and installing new version of push notification.
uninstall:
npm uninstall react-native-push-notification
install:
npm i react-native-push-notification
since react-native-push-notification upgraded to new version v7.x so that, while installing app it give above error.
checkout this -> https://www.npmjs.com/package/react-native-push-notification
There is an issue, in react-native-push-notification (FirebaseInstanceId has been deprecated and now removed). Sounds like you are using a lib that is using that that here. It should be fixed later on, but for now you can add the following to your android/build.gradel file.
buildscript {
ext {
...
firebaseMessagingVersion = "21.0.0"
}
I had also to update these libs (you will get compile errors if you don't, so you may have others to update):
- "react-native-device-info": "^5.5.8",
+ "react-native-device-info": "^8.1.3",
- "react-native-push-notification": "^7.3.0",
+ "react-native-push-notification": "^7.3.1",
This is in reference to this issue
wix/react-native-notifications
This lib having issue with refreshToken() Method.
Didn't find class "com.google.firebase.iid.FirebaseInstanceId"
so just remove / reinstall the package, if still error is coming then we have to wait for next bug fix release of this lib or
we can manually change native code to make it working.
below is link of lib
https://github.com/wix/react-native-notifications/issues?q=FirebaseInstanceId

firebase crashes on phones on first app launch [duplicate]

Currently using react native, react-native-firebase, and react-native-push-notification. Everything was fine until suddenly today firebase messaging started causing the app to crash. The error message is the following:
Process: com.packagename, PID: 30087
java.lang.AbstractMethodError: abstract method "com.google.android.gms.tasks.Task com.google.firebase.iid.WithinAppServiceBinder$IntentHandler.zza(android.content.Intent)"
at com.google.firebase.iid.WithinAppServiceBinder.zza(com.google.firebase:firebase-iid##20.2.2:9)
at com.google.firebase.iid.zzaw.zza(com.google.firebase:firebase-iid##20.2.2:30)
at com.google.firebase.iid.zzaw.onServiceConnected(com.google.firebase:firebase-iid##20.2.2:59)
at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:2067)
at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:2099)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:8016)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1076)
The error occurs when a notification is received, but does not trigger a data message. In addition, the notification is received and processed before causing the crash.
I thought the error might have been caused by changing the react-native-firebase/app version, so I reverted my project on git to that of a previous, working version. However, I still get the same error after cleaning and rebuilding. It also occurs even if there are no notification listeners set up on the react native side, although I'm not sure what that entails for the actual native code. What could possibly be the problem? I'm using versions of react-native-firebase/messaging (7.1.5) and react-native-firebase/app (7.2.0) that were previously functional.
Edit 07/09/2020: We have released firebase-iid and firebase-messaging versions 20.2.3 with a fix for this issue, please upgrade to the latest versions.
[Firebaser here] It looks like yesterday's releases of firebase-messaging and firebase-iid contain a bug which can cause this crash. We are working hard on a fix.
For now the best thing to do is to use the versions released on June 18th:
https://firebase.google.com/support/release-notes/android#2020-06-18
com.google.firebase:firebase-messaging:20.2.1
com.google.firebase:firebase-iid:20.2.1
We are working on a fix and hope to have a new release out soon. When we do I will update this answer and the release notes will be available here:
https://firebase.google.com/support/release-notes/android
We tried adding firebaseMessagingVersion = "20.2.1" into the ext section in the root project android/build.gradle which fixed it for us. We looked into the safeExtGet method and found that it would try to extract the top level variable from the root project file.
By doing it in this way we didn't need to touch the node modules.
ext {
googlePlayServicesVersion = "16.+"
firebaseVersion = "17.3.4"
firebaseMessagingVersion = "20.2.1"
}
Exact same issue with these versions. And yes they were functional before this
"#react-native-firebase/app": "^6.7.1",
"#react-native-firebase/messaging": "^6.7.1",
Issue Solved:
Go to react-native-push-notification/build.gradle
Change
def firebaseVersion = safeExtGet('firebaseVersion', '+')
to
def firebaseVersion = safeExtGet('firebaseVersion', '20.2.1')
It was picking us the version 20.2.2 which is not stable and was causing all kind of weird issues.
This upgrade fixed the issue for me
implementation 'com.google.firebase:firebase-messaging:20.2.3'
This case is working for me:
implementation "com.google.firebase:firebase-messaging:20.2.3"
implementation "com.google.firebase:firebase-analytics:17.4.4"
Ref to github issue
This issue is fixed with latest version of this dependency.
https://firebase.google.com/support/release-notes/android#messaging_v20-2-3

Uri.java line 475 android.net.Uri$StringUri.<init> com.google.android.gms.ads

I'm getting an error from different device versions (Android 5 - Android 8) since I use ads:
implementation 'com.google.android.gms:play-services-ads:16.0.0'
My error looks like this:
Fatal Exception: java.lang.NullPointerException: uriString
at android.net.Uri$StringUri.<init>(Uri.java:475)
at android.net.Uri$StringUri.<init>(Uri.java)
at android.net.Uri.parse(Uri.java:437)
at com.google.android.gms.ads.internal.video.a.a(:com.google.android.gms.dynamite_adsdynamite#14366046#14.3.66 (040306-213742215):13)
at com.google.android.gms.ads.internal.video.gmsg.f.a(:com.google.android.gms.dynamite_adsdynamite#14366046#14.3.66 (040306-213742215):148)
at com.google.android.gms.ads.internal.webview.j.a(:com.google.android.gms.dynamite_adsdynamite#14366046#14.3.66 (040306-213742215):293)
at com.google.android.gms.ads.internal.webview.ac.run(Unknown Source:4)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at com.google.android.gms.ads.internal.util.e.dispatchMessage(:com.google.android.gms.dynamite_adsdynamite#14366046#14.3.66 (040306-213742215):5)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1518)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)
any help is apreciated
There is a bug in version 17.0.0 either you're using
implementation 'com.google.android.gms:play-services-ads:17.0.0' //or
implementation 'com.google.firebase:firebase-ads:17.0.0'
You can check this thread for more detail.
According to the post from Mobile Ads SDK Team member, issue has been fixed but there is no ETA as of now.
EDIT
I found that above issue is not related to particular admob version. From last week most of the apps with AdMob start crashing, It doesn't matter what admob version you're using. I think there is issue with server side or how they delivered ads(may be getting null in response) and not handled in AdMob SDK level.
So Currently we've
Issue with Server side
May be some issue in version 17.0.0
Issue already submitted to Mobile Ads SDK team so we've only option to wait for server side fixes or we may get another release after 17.0.0.
I also encountered this issue when I upgraded my ads dependency to the latest version, to find a proper solution keep checking this thread as mentioned by #Aryan in other answer. As a workaround for now you can use the following dependency:
implementation 'com.google.android.gms:play-services-ads:15.0.0'
this will keep the crash from occurring.

Android Facebook Account Kit Crash - missing metadata: /com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CN

I am suddenly getting a number of crash reports around this the past few weeks. The crashes indicated missing metadata for certain country code. Most of them have been one of:
PhoneNumberMetadataProto_CN
PhoneNumberMetadataProto_BR
PhoneNumberMetadataProto_IR
The crashes seems to have occurred out of nowhere. I attempted to upgrade the AccountKit version from 4.28.0 to 4.31.0. This resulted in a moving where the crash occurred from com.facebook.accountkit.internal.Utility.parseNumber to com.facebook.accountkit.ui.PhoneNumberTextWatcher.getFormattedNumber but the crash is still occurring.
My next plan of attack is to try including the com.googlecode.libphonenumber dependency directly via Gradle instead of letting it just get included transitively from the AccountKit SDK, but I'm not holding my breath that it will fix the problem. Any other ideas are much appreciated.
I am having same problem here.
i am endup with adding dependency in gradle (like your next plan). Its working fine.
dependencies {
...
compile 'com.googlecode.libphonenumber:libphonenumber:8.+'
}

Firebase Crash Library - NullPointerException in the console

I've implemented the new Firebase Crash library (https://github.com/firebase/quickstart-android/tree/master/crash) to log error in Android app.
Anyone is having similar problem.
I'm checking errors and on the top I've got:
Exception java.lang.NullPointerException: Attempt to invoke virtual method 'byte[] java.lang.String.getBytes()' on a null object reference
android.util.Base64.decode (Base64.java:118)
com.google.firebase.iid.zzg.zzeH (zzg.java:)
com.google.firebase.iid.zzg.zzeE (zzg.java:)
com.google.firebase.iid.zzd.zzCd (zzd.java:)
com.google.firebase.iid.zzd.zzc (zzd.java:)
com.google.firebase.iid.zzd.getToken (zzd.java:)
com.google.firebase.iid.FirebaseInstanceId.getToken (FirebaseInstanceId.java:)
com.google.firebase.iid.FirebaseInstanceId.zzUo (FirebaseInstanceId.java:)
com.google.firebase.iid.FirebaseInstanceIdService.zza (FirebaseInstanceIdService.java:)
com.google.firebase.iid.FirebaseInstanceIdService.zzm (FirebaseInstanceIdService.java:)
com.google.firebase.iid.zzb$2.run (zzb.java:)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1112)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:587)
java.lang.Thread.run (Thread.java:818)
I have checked but there are not extra proguard rules for Firebase Crash.
Is it bug in the library? Anyone is having similar problem?
I can't reproduce error on my devices.
The error is strange and I don't know in which place in the application. Nothing so I think it's connected to Crash library.
This is not standard nullexception. It's connected to Firebase Crash library. Why I'm thinking this is library bug - there is no sign on my code/activity here.
It was confirmed by Google that this was bug in the InstanceID library.
All you can do right now is to update to the latest version and hope this will be fixed.
compile 'com.google.firebase:firebase-crash:9.4.0'
Note #1
You can see in the comments that some people are still getting this error. At the moment we can't do nothing more than update to the latest version. If you've been using previous version - update to the latest. We need info from Firebase team about it.
Note #2
This seems to be fixed in 9.4.0 but we still need confirmation
Seems to be fixed in
compile 'com.google.firebase:firebase-crash:9.4.0'
This is a bug in the InstanceID library in 9.0, sorry. We've identified a fix and will include it in a future SDK release.
We believe it should be fairly rare, but please comment if you're seeing a large number of devices.
There is a new version of Google Play Services available: 9.2.1. Apparently it has the fix inside. I'll confirm it once I have enough data.

Categories

Resources