JMRboosties
JMRboosties

Reputation: 15740

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!

Upvotes: 10

Views: 1434

Answers (3)

rayworks
rayworks

Reputation: 796

Also checked the release notes:

SDK Version 11.8.0 - December 18, 2017

Cloud Messaging

  • Fixed an internal NullPointerException caused by a call to NetworkInfo.isConnected().

Upvotes: 0

Kshitij Jain
Kshitij Jain

Reputation: 569

Had same issue. Fixed in Firebase SDK 11.8.0.

Upvotes: 2

Patrick Boos
Patrick Boos

Reputation: 7029

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.

Upvotes: 7

Related Questions