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
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
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
Using Navigation component alpha09 and have added apply plugin: "androidx.navigation.safeargs" to top of base module build.gradle but getting following error when doing gradle sync. I'm using Android Studio 3.4 Canary 9 (but also had same problem using 3.3 RC3)
It looks like a related fix was included in alpha09 - https://issuetracker.google.com/issues/119662045
Caused by: kotlin.TypeCastException: null cannot be cast to non-null type org.gradle.api.resources.TextResource
at androidx.navigation.safeargs.gradle.SafeArgsPlugin.setApplicationId(SafeArgsPlugin.kt:87)
at androidx.navigation.safeargs.gradle.SafeArgsPlugin.access$setApplicationId(SafeArgsPlugin.kt:39)
at androidx.navigation.safeargs.gradle.SafeArgsPlugin$apply$1$task$1.execute(SafeArgsPlugin.kt:63)
at androidx.navigation.safeargs.gradle.SafeArgsPlugin$apply$1$task$1.execute(SafeArgsPlugin.kt:39)
at org.gradle.api.internal.tasks.DefaultTaskContainer.create(DefaultTaskContainer.java:360)
at androidx.navigation.safeargs.gradle.SafeArgsPlugin$apply$1.invoke(SafeArgsPlugin.kt:59)
at androidx.navigation.safeargs.gradle.SafeArgsPlugin$apply$1.invoke(SafeArgsPlugin.kt:39)
at androidx.navigation.safeargs.gradle.SafeArgsPluginKt$sam$org_gradle_api_Action$0.execute(SafeArgsPlugin.kt)
at org.gradle.internal.ImmutableActionSet$SingletonSet.execute(ImmutableActionSet.java:225)
at org.gradle.api.internal.DefaultDomainObjectCollection.doAdd(DefaultDomainObjectCollection.java:247)
at org.gradle.api.internal.DefaultDomainObjectCollection.add(DefaultDomainObjectCollection.java:236)
at com.android.build.gradle.LibraryExtension.addVariant(LibraryExtension.java:93)
at com.android.build.gradle.FeatureExtension.addVariant(FeatureExtension.java:121)
at com.android.build.gradle.internal.ApiObjectFactory.create(ApiObjectFactory.java:134)
Just updated to alpha11 and not seeing this issue any more. (https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0-alpha11)
UPDATE
From comments below it looks like alpha11 didn't resolve issue for some people but beta1 did
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.
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.