quickstart-android icon indicating copy to clipboard operation
quickstart-android copied to clipboard

NullPointerException: Attempt to invoke interface method 'java.util.Iterator java.util.List.iterator()' on a null object reference at com.google.android.gms.internal.zzblq.zzc(Unknown Source)

Open DevUnderos opened this issue 9 years ago • 65 comments

After using firebase (Analytics, Cloud Messaging, Remote Config) libraries i'm having this problem on different os versions of android.

Issue details from Fabric.

Fatal Exception: java.lang.NullPointerException: Attempt to invoke interface method 'java.util.Iterator java.util.List.iterator()' on a null object reference
       at com.google.android.gms.internal.zzblq.zzc(Unknown Source)
       at com.google.android.gms.internal.zzblq.zza(Unknown Source)
       at com.google.android.gms.internal.zzbtm.run(Unknown Source)
       at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
       at java.lang.Thread.run(Thread.java:818)

Firebase v10.2.1

DevUnderos avatar Jun 20 '17 07:06 DevUnderos

@DevUnderos can you provide any more information to help debug? What action are you users performing when this happens? What version of the Firebase SDK are you using?

samtstern avatar Jun 20 '17 15:06 samtstern

Hi all, I'm having same problem like this. I used firebase with version Firebase 10.2.1. Do you have solution for this case ? Thanks

OS Version: 6.0.1 RAM Free: 32% Disk Free: 58.2%

Fabric was report below: Fatal Exception: java.lang.NullPointerException: Attempt to invoke interface method 'java.util.Iterator java.util.List.iterator()' on a null object reference at com.google.android.gms.internal.zzblq.zzc(Unknown Source) at com.google.android.gms.internal.zzblq.zza(Unknown Source) at com.google.android.gms.internal.zzbtm.run(Unknown Source) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818)

tictacpc avatar Jun 20 '17 16:06 tictacpc

same error here for Android 7.0 we have seen this.

ko (Deobfuscated class name) com.google.android.gms.internal.ko.zzaQ
Fatal Exception: java.lang.NullPointerException: Attempt to invoke interface method 'java.util.Iterator java.util.List.iterator()' on a null object reference
       at com.google.android.gms.internal.ko.zzaQ(Unknown Source)
       at com.google.android.gms.internal.ko.zzaQ(Unknown Source)
       at com.google.android.gms.internal.afv.run(Unknown Source)
       at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
       at java.lang.Thread.run(Thread.java:762)

spirosoik avatar Jun 27 '17 16:06 spirosoik

Exactly same here: com.google.android.gms.internal.zzblq.zzc, reported by Crashlytics, not reproducible in Lab. Only reported on ARM devices, but other factors: OS version, manufacturer - seem to be irrelevant.

This began as soon as we started to work with firebase, May 13, 2017. Our current version is 10.2.4. And number of crashes per day is not uniform:

fabric

alexcohn avatar Jun 29 '17 14:06 alexcohn

Just to add more info it seems that it happens on application open. Also it happens at least for us for OS Version: 6.0.1 and 7.0.

spirosoik avatar Jun 29 '17 14:06 spirosoik

The classes of com.google.android.gms.internal are obfuscated, but from what I can derive, a null List can result from unsuccessful call (via invoke()) to AppMeasurement.class.getDeclaredMethod("getConditionalUserProperties"), in static List<Object> zzblq.zzb(AppMeasurement var0, String var1), in firebase-config-10.2.4.

The only public trigger for this seems to be Task fetch(long var1) in FirebaseRemoteConfig class.

I think we can really ignore the root cause - why some object is null at this point, as long as the app can not verify that the SDK is prepared to call fetch(). The problem here is that the crash happens in an async call, and there seems to be no clean way to catch an unhandled exception there.

One simple fix would be to simply add NullPointerException to the list of catch in zzblq.class:189, which today is

} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException var4) {
  Log.e("FirebaseAbtUtil", "Could not complete the operation due to an internal error.", var4);
}

make it

} catch (NullPointerException | IllegalAccessException | InvocationTargetException | NoSuchMethodException var4) {
  Log.e("FirebaseAbtUtil", "Could not complete the operation due to an internal error.", var4);
  var2 = new ArrayList();
}

… and the end-user will at least have a chance to recover.

alexcohn avatar Jun 29 '17 15:06 alexcohn

@Guys it's serious problem it happens more and more in the production app! Around a huge number of crashes for each user.

For us started after upgrading to google play services + firebase 11.0.0

spirosoik avatar Jun 29 '17 15:06 spirosoik

@alexcohn good catch, we have enabled remote config lately in the app. Let me have a quick test on something and I will come back to you.

spirosoik avatar Jun 29 '17 16:06 spirosoik

This looks similar to me: https://stackoverflow.com/questions/42362024/firebase-remote-config-nullpointerexception-on-map-keyset

alexcohn avatar Jun 30 '17 15:06 alexcohn

@alexcohn it seems that this issue occurs when you are using RemoteConfig and you haven't anything set it up as config parameters. If you add some parameters this will never crash again. (at least till now no errors)

But this should be fixed in any case.

spirosoik avatar Jun 30 '17 15:06 spirosoik

We have had a similar issue see here - https://stackoverflow.com/questions/42362024/firebase-remote-config-nullpointerexception-on-map-keyset . We were having crashes for a lot of users in released build as reported by Crashlytics. We reported it as bug to firebase and with a series of mail lasted about 15 - 20 days, firebase team accepted it is a bug in their remote config library. And we eventually have to remove Firebase remote config from our App. This happened with us about 4 months ago. They said they will fix this in the next release. We will be making another release with Remote config re-integrated. Will update if similar issue occurs with us again.

ashtrisk avatar Jul 01 '17 14:07 ashtrisk

Experiencing the same issues in our project. Random crashes with report like that:

Exception java.lang.NullPointerException: Attempt to invoke interface method 'java.util.Iterator java.util.List.iterator()' on a null object reference com.google.android.gms.internal.zzblq.zzc () com.google.android.gms.internal.zzblq.zza () com.google.android.gms.internal.zzbtm.run () android.os.AsyncTask$SerialExecutor$1.run (AsyncTask.java:231) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1112) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:587) java.lang.Thread.run (Thread.java:818)

But for us this happens ONLY on Samsung devices, for some reason. Can't say after which Firebase update exactly this has started, but if I remove Firebase from the project completely - the issues disappears.

jphw avatar Jul 12 '17 12:07 jphw

@jphw, have you checked https://github.com/firebase/quickstart-android/issues/291#issuecomment-312294335? Maybe all you need is set up the defaults, as described in step 2 ?

alexcohn avatar Jul 12 '17 13:07 alexcohn

@alexcohn yes, we will add the defaults to our next release and hope that it will help (it does not reproduce on our devices so we will have to test it on our users).

jphw avatar Jul 13 '17 09:07 jphw

@spirosoik Beware, this didn't fix it for me on all devices, it is still happening sometimes even with setDefaults();

eXeP avatar Jul 17 '17 13:07 eXeP

@eXeP till now for us no errors at all.

spirosoik avatar Jul 17 '17 13:07 spirosoik

I've been receiving these ever since 11.0.0 (on 11.0.4 now - android version 7.1.2):

08-15 23:58:05.974 16308-16435/com.myapp E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
    Process: com.myapp, PID: 16308
    java.lang.NullPointerException: Attempt to invoke interface method 'java.util.Iterator java.util.List.iterator()' on a null object reference
        at com.google.android.gms.internal.in.zzc(Unknown Source)
        at com.google.android.gms.internal.in.zza(Unknown Source)
        at com.google.android.gms.internal.abf.run(Unknown Source)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
        at java.lang.Thread.run(Thread.java:761)

eygraber avatar Aug 16 '17 04:08 eygraber

Hi guys, we recently released an update for our app with remote config added back again. And we didn't get any crashes with it. I believe this issue has been solved with the latest library release for remote config.

ashtrisk avatar Aug 26 '17 14:08 ashtrisk

I faced to same problem. (My app was applied firebaseVersion 11.0.2. at now) @ashtrisk said that this problem was fixed at latest version, (it may be 11.2.0 : https://firebase.google.com/support/release-notes/android) When I release next time, I will try to apply 11.2.0 version. Thank you for share.

Devik0213 avatar Aug 28 '17 01:08 Devik0213

I use firebase version 11.2.0 (core, crash, messaging, config) and I'm still having this problem:

Exception java.lang.NullPointerException: Attempt to invoke interface method 'java.util.Iterator java.util.List.iterator()' on a null object reference com.google.android.gms.internal.zzebe.run (zzebe.java) android.os.AsyncTask$SerialExecutor$1.run (AsyncTask.java:234) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1113) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:588) java.lang.Thread.run (Thread.java:818)

ghost avatar Sep 06 '17 11:09 ghost