java.lang.NullPointerException: Attempt to read from field ‘int com.android.okio.Segment.limit’ on a null object reference

Fatal Exception: java.lang.NullPointerException: Attempt to read from field ‘int com.android.okio.Segment.limit’ on a null object reference
at com.android.okio.OkBuffer.write + 574(OkBuffer.java:574)
at com.android.okio.OkBuffer.read + 610(OkBuffer.java:610)
at com.android.okio.RealBufferedSource.read + 56(RealBufferedSource.java:56)
at com.android.okhttp.internal.http.HttpConnection$FixedLengthSource.read + 469(HttpConnection.java:469)
at com.android.okhttp.internal.Util.skipAll + 227(Util.java:227)
at com.android.okhttp.internal.http.HttpConnection.discard + 239(HttpConnection.java:239)
at com.android.okhttp.internal.http.HttpConnection$FixedLengthSource.close + 491(HttpConnection.java:491)
at com.android.okio.RealBufferedSource.close + 204(RealBufferedSource.java:204)
at com.android.okio.RealBufferedSource$1.close + 187(RealBufferedSource.java:187)
at com.google.android.gms.internal.firebase_messaging.zzk.zza + 4(zzk.java:4)
at com.google.firebase.messaging.zzd.close + 37(zzd.java:37)
at com.google.firebase.messaging.zzc.zzas + 51(zzc.java:51)
at com.google.firebase.messaging.FirebaseMessagingService.zzd + 59(FirebaseMessagingService.java:59)
at com.google.firebase.iid.zzb.run + 2(zzb.java:2)
at java.util.concurrent.ThreadPoolExecutor.runWorker + 1112(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run + 587(ThreadPoolExecutor.java:587)
at com.google.android.gms.common.util.concurrent.zza.run + 6(zza.java:6)
at java.lang.Thread.run + 818(Thread.java:818)

3 thoughts on “java.lang.NullPointerException: Attempt to read from field ‘int com.android.okio.Segment.limit’ on a null object reference

  1. This is really sad that so many users faced the same issue but still we don’t have a solution. Firebase team should do something in future updates. For time being i will not use the images.

  2. @Yonghejiunian sorry for my slow response here (I was on vacation) but can you give some more information on how to reproduce this issue?

    I Dismantling the aar(firebase-messaging-18.0.0.aar) make it come to local(firebase-messaging-18.0.0_fixcrash.aar) , add “try catch ” and remove “final” in method “public void zzd(Intent var1) “, now is ok ,no crash ,i will make a ABTest, hope you fix this bug, many developers has such issue!