android – Google maps crash: java.lang.NullPointerException: Attempt to read from null array-ThrowExceptions

Exception or error:

I see a lot of following crashes in Crashlytics:

Fatal Exception: java.lang.NullPointerException: Attempt to read from null array
   at java.util.ArrayList.get(
   at android.os.Handler.dispatchMessage(
   at android.os.Looper.loop(

All of them happen on Android 5, mostly on Lenovo devices.

The map is loaded in SupportMapFragment.

Dependencies (current latest):

What could be the cause of this crash?

How to solve:

Ok, so I opened a ticket on google issue tracker and a lot of people confirmed they were facing the same crash.

Seems like an internal bug ticket was created and the work is being done to resolve the issue on maps side.
Also a temporary workaround was suggested in comments:

The workaround, that worked for me is to set maxZoomPreference on the
map equal to 16 and to use 16 as zoom level in the calling of the
newLatLngZoom method. It seems that the issue occurs only when you try
to zoom more than 16 levels.

We implemented the suggested approach in our app and it indeed prevents the crash.


According to Google the crash was fixed for future SDK versions.

Upon further checking, our Engineering Team was able to reproduce the
problem and already fixed it in the latest SDK version.

Leave a Reply

Your email address will not be published. Required fields are marked *