Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase SDK crash on receiving broadcast intents

In a recent update we began seeing 2 crashes coming from Firebase. Neither of these crashes are reproducible, and they happen pretty infrequently, but frequently enough for us to be concerned. The first one appear 99% of the time on Android 7 (1% on Android 5):

Fatal Exception: java.lang.RuntimeException: Error receiving broadcast Intent { act=android.net.conn.CONNECTIVITY_CHANGE flg=0x4000010 (has extras) } in com.google.firebase.iid.f@96947cd
       at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:1132)
       at android.os.Handler.handleCallback(Handler.java:751)
       at android.os.Handler.dispatchMessage(Handler.java:95)
       at android.os.Looper.loop(Looper.java:154)
       at android.app.ActivityThread.main(ActivityThread.java:6119)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.net.NetworkInfo.isConnected()' on a null object reference
       at com.google.firebase.iid.zzad.zzchp(Unknown Source)
       at com.google.firebase.iid.zzae.onReceive(Unknown Source)
       at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:1122)
       at android.os.Handler.handleCallback(Handler.java:751)
       at android.os.Handler.dispatchMessage(Handler.java:95)
       at android.os.Looper.loop(Looper.java:154)
       at android.app.ActivityThread.main(ActivityThread.java:6119)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

And this one comes exclusively from Android 8:

Fatal Exception: java.lang.RuntimeException: Error receiving broadcast Intent { act=android.net.conn.CONNECTIVITY_CHANGE flg=0x4000010 (has extras) } in com.google.firebase.iid.f@8746d6a
       at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$-android_app_LoadedApk$ReceiverDispatcher$Args_52497(LoadedApk.java:1323)
       at android.app.-$Lambda$aS31cHIhRx41653CMnd4gZqshIQ.$m$7(Unknown Source:4)
       at android.app.-$Lambda$aS31cHIhRx41653CMnd4gZqshIQ.run(Unknown Source:39)
       at android.os.Handler.handleCallback(Handler.java:790)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6494)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.net.NetworkInfo.isConnected()' on a null object reference
       at com.google.firebase.iid.zzad.zzchp(Unknown Source:24)
       at com.google.firebase.iid.zzae.onReceive(Unknown Source:7)
       at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$-android_app_LoadedApk$ReceiverDispatcher$Args_52497(LoadedApk.java:1313)
       at android.app.-$Lambda$aS31cHIhRx41653CMnd4gZqshIQ.$m$7(Unknown Source:4)
       at android.app.-$Lambda$aS31cHIhRx41653CMnd4gZqshIQ.run(Unknown Source:39)
       at android.os.Handler.handleCallback(Handler.java:790)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6494)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

Unfortunately the Firebase SDK is obfuscated so I can't see the full context of the crash, but the exception being thrown is an NPE on a NetworkInfo object trying to perform the isConnected method.

These are the firebase libs we are using in this build:

api "com.google.firebase:firebase-config:11.6.2"
api "com.firebase:firebase-jobdispatcher:0.8.4"

We upgraded the firebase-config lib from 11.2.0 to 11.6.2 and added the jobdispatcher lib between the previous release and this new release where we began seeing the crash. I've searched around but haven't seen any existing conversations about the issue, if anyone has insight we'd really appreciate it. Thanks!

like image 853
JMRboosties Avatar asked Dec 06 '17 20:12

JMRboosties


Video Answer


2 Answers

I got an official answer from the firebase team to the bug report I sent concerning this issue:

Yes, you are right. This is currently an issue from Firebase SDK 11.6.0 onwards.
Our engineers are currently working on a fix for this issue, but I can't share any details or timelines at this time.

In the meantime, I would suggest you to use the older version of the Firebase SDK.

You may check our release notes for any further updates.

like image 58
Patrick Boos Avatar answered Oct 28 '22 02:10

Patrick Boos


Had same issue. Fixed in Firebase SDK 11.8.0.

like image 2
Kshitij Jain Avatar answered Oct 28 '22 01:10

Kshitij Jain