Quickstart-android: 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)

Created on 20 Jun 2017  Â·  65Comments  Â·  Source: firebase/quickstart-android

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

remoteconfig known-issue

Most helpful comment

Hi all

This should finally be fixed in SDK version 15.0.0. For everyone who was affected by this bug for so long: we apologize and will do better. We had a number of internal mishaps that resulted in this bugfix taking forever to be deployed. We have already circulated a postmortem internally to make sure we don't do this again.

Thank you to everyone who added their thoughts here.

All 65 comments

@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?

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)

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)

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

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.

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.

@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

@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.

@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.

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.

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, 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 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).

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

@eXeP till now for us no errors at all.

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)

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.

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.

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)

It's the same with 11.2.2 as well, crashes happen.

crash happens with 11.4.2 and setting config parameters for RemoteConfig on different devices

We are also experiencing this same issue.

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.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)

Hi all, I used version 11.0.4 on Firebase and I was changed config default parameter values using Map object and don't use XML resource. It seems work and I don't see happen again.
please check the config Map object and give me the result of you? thanks

I used map instead of XML with 11.2.0 version and null pointer appeared.

Any news on this? Does the error still occur?

@spirosoik do you mean remote_config_defaults file ?

crash still happens with version 11.8.0

It is still present in version 11.6.2:

Fatal Exception: java.lang.NullPointerException
at com.google.android.gms.internal.zzdtm.zzcz(Unknown Source)
at com.google.android.gms.internal.zzdtm.zzcz(Unknown Source)
at com.google.android.gms.internal.zzevr.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:841)

I think this problem occurs because of console rules.
I figured out this way,
Go to Firebase Console
select database then select rules tab from there
and change allow read, write: if true;

The last full source of rules tab should be like bottom

service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write: if true;
    }
  }
}

This is worked for me.

NullPointerException we are talking about here is connected with with Remote Config. I implemented my own config functionality and abandoned provided by Firebase and the problem stopped appearing.

Reproduced in 11.4.2 when calling remoteConfig.setDefaults() with an empty map.

@Syhids could you share the exact code that reproduces this? A full github repo I could clone/run would be amazing (if it's not too much to ask)

@samtstern we have this issue "reproduced". But a) the exact code is private and huge; and b) the crash happens for ~0.002% of our users. It happens ~2.5 times a day per affected user.

PS I am glad you're here again

Sorry when I say "reproduce" I mean some code I can run on my own machine and see the issue predictably. That's the only way we will really be able to dive into this any further.

@samtstern this does not happen on computer. It happens on end users' smartphones, sometimes. It happens inside the Firebase SDK, in some async thread there. Please see my analysis of June 29, 6 months ago. I proposed an easy fix that will let us, app developers, to mitigate this problem. Are there some serious concerns about using this approach?

@alexcohn we're already pursuing a fix internally (in fact I am checking to see when it will be released) but I was just hoping we could double verify it based on your code or someone else's.

As an aside, it's almost never a good idea to catch a NullPointerException. Instead we need to find the null reference and not call any methods on it, which is what we believe our fix does.

You are right in principle; my proposal was what one can come up with looking briefly at obfuscated code of external SDK. But sometimes a quick workaround is better than six months of unhandled crashes.

@alexcohn makes sense and I agree, we've taken too long to get a fix/update to everyone. In part this was because we couldn't actually get our own tests to crash. Hopefully will have something for you soon.

@samtstern sorry, I can't share the whole project. I could try to isolate the bug if you still need it :)

@Syhids thanks, don't worry about it right now. I am chasing down a few things internally and will let you know if we need to go that far!

Android device:Micromax, Canvas Unite 4
Android OS version: 6.0
Firebase/Play Services SDK version: 11.8.0

Crash Report details:

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.zzdvs.zzc(Unknown Source)
at com.google.android.gms.internal.zzdvs.zza(Unknown Source)
at com.google.android.gms.internal.zzexc.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)

Just to update, we have identified the problem and the fix will come in a future release. I will update here when that release happens.

Any update on this? I keep getting crash reports and I am going to need to remove Remote Config from the app unless there is an update soon. Do you have a schedule at least?

Any update to this? I am getting exactly same crash with Samsung device only! When can we expect the fix?

Still getting it right after

            .getInstance()
            .fetch(CACHE_EXPIRATION_SECONDS)
            .addOnCompleteListener(
                (task) -> {
                    if (task.isSuccessful()) {
                        mFirebaseRemoteConfig.activateFetched();

firebase 11.4.2

Device:

System: 3.14.29 (20171109.180937.V0928)
Sdk: 25
Device: M8SPRO
Product: q20x
Manufacturer: Amlogic
Model: Nexus M8S PRO

hey guys, any updates on this?
I'm getting the same crash report on various devices, with APIs 19 - 24

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)

in gradle:
compile 'com.google.firebase:firebase-core:10.2.0'
compile 'com.google.firebase:firebase-config:10.2.0'
compile 'com.google.firebase:firebase-messaging:10.2.0'
compile 'com.google.firebase:firebase-database:10.2.0'
compile 'com.google.firebase:firebase-crash:10.2.0'

target SDK 23

does it makes sense to update Firebase libs to the latest version? Or I can get even more bugs?
Did you try to wrap remote config calls with catch(NullPointerException ex) ?

Any news about this issue? I'm using firebase-11.6.0 and the issue still happens in crashlytics logs.

crash cannot be reproduced

Same crash with:

  • Firebase: 11.4.2
  • targetSdk: 27
  • compileSdk: 27
  • buildTools: 27.0.3

@samtstern We have new release (12.0.0). Have you fixed the error? I can see no information about this in the release notes.

I've been able to see this on my debug builds and 12.0.0 does not fix the problem.

I was getting this error for a long time. Then I removed:

    <meta-data android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />

... from the AndroidManifest and everything worked! (I figured that since I use "apply plugin: 'com.google.gms.google-services'" at the end of my build.gradle, I might not need it)

However, I can no longer reproduce the problem, so maybe that is just co-incidence. I was using 11.8.0. This was occurring for me during the setDefaults call, but only if it was done before the fetch.

@pbizannes I didn't use google_play_services_version meta-data in the manifest file and was experiencing the problem.

@samtstern any updates regarding this fix? If this is not fixed in 12.0, is it possible to include it tot 12.0.1 please?

12.0.1 still crashes.

It is one big joke from the firebase team. One year later and the problem (big problem!) still exists. I'm glad I removed RemoteConfig a few months ago.

I agree, new version has this issue, 11 users and 77 crashes in 7 days.... Is there any chance to get answer from Google devs? RemoteConfig is useless now.

It looks like I'm getting this issue only on devices which most probably don't have Google Services. For example:

  • Amazon AFTN (Fire TV?)
  • Nexus M8S PRO (some Chinese tv box, which most probably doesn't have proper GMS)

Hi guys,

I'm facing the same problem since I've implemented Remote Config.
But, i've got a little different stacktrace :

Fatal Exception: java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.Object java.util.Map.get(java.lang.Object)' on a null object reference
       at android.os.Parcel.readException(Parcel.java:1626)
       at android.os.Parcel.readException(Parcel.java:1573)
       at com.google.android.gms.internal.zzeu.zzb(Unknown Source)
       at com.google.android.gms.internal.zzbik.zza(Unknown Source)
       at com.google.android.gms.internal.zzbhr.zza(Unknown Source)
       at com.google.android.gms.internal.zzbht.zza(Unknown Source)
       at com.google.android.gms.common.api.internal.zzm.zzb(Unknown Source)
       at com.google.android.gms.common.api.internal.zzc.zza(Unknown Source)
       at com.google.android.gms.common.api.internal.zzbo.zzh(Unknown Source)
       at com.google.android.gms.common.api.internal.zzbo.zzaiw(Unknown Source)
       at com.google.android.gms.common.api.internal.zzbo.onConnected(Unknown Source)
       at com.google.android.gms.common.internal.zzac.onConnected(Unknown Source)
       at com.google.android.gms.common.internal.zzn.zzj(Unknown Source)
       at com.google.android.gms.common.internal.zze.zzakr(Unknown Source)
       at com.google.android.gms.common.internal.zzi.zzaks(Unknown Source)
       at com.google.android.gms.common.internal.zzh.handleMessage(Unknown Source)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:148)
       at android.os.HandlerThread.run(HandlerThread.java:61)

Using the last firebase version or using a map for defaults values instead of an xml changed nothing.

@stari4ek Most of the crashes i've got are on device that have the Google Play Services installed.
Most of them have a recent version installed ( > 12.5.xxx).
I don't think it's related to that.

Hi all

This should finally be fixed in SDK version 15.0.0. For everyone who was affected by this bug for so long: we apologize and will do better. We had a number of internal mishaps that resulted in this bugfix taking forever to be deployed. We have already circulated a postmortem internally to make sure we don't do this again.

Thank you to everyone who added their thoughts here.

And with 15.0.0 there is another one introduced:

Caused by java.lang.NullPointerException
Attempt to invoke virtual method 'void com.google.android.gms.internal.config.zzar.zzc(long)' on a null object reference
com.google.firebase.remoteconfig.FirebaseRemoteConfig. (Unknown Source)
com.google.firebase.remoteconfig.FirebaseRemoteConfig.getInstance (Unknown Source)
com.google.firebase.remoteconfig.FirebaseRemoteConfig.getInstance (Unknown Source)

never ending story

Should I create new issue here?

@stari4ek yes please do create a new issue, thank you for flagging this.

I was also seraching for this solution .

LInk : https://stackoverflow.com/questions/45961045/react-native-android-error

check this out.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hungud picture hungud  Â·  6Comments

charlizesmith picture charlizesmith  Â·  5Comments

kaushikb1996 picture kaushikb1996  Â·  4Comments

wellbranding picture wellbranding  Â·  3Comments

shivamsriva31093 picture shivamsriva31093  Â·  3Comments