Google Maps崩溃:java.lang.NullPointerException:尝试从空数组读取 [英] Google maps crash: java.lang.NullPointerException: Attempt to read from null array

查看:105
本文介绍了Google Maps崩溃:java.lang.NullPointerException:尝试从空数组读取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Crashlytics中看到很多以下崩溃信息:

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(ArrayList.java:310)
   at com.google.maps.api.android.lib6.gmm6.vector.gl.drawable.g.a(g.java:56)
   at com.google.maps.api.android.lib6.gmm6.vector.gl.drawable.ao.a(ao.java:91)
   at com.google.maps.api.android.lib6.gmm6.store.fetch.i.a(i.java:99)
   at com.google.maps.api.android.lib6.gmm6.store.fetch.f.a(f.java:3)
   at com.google.maps.api.android.lib6.gmm6.store.j.a(j.java:19)
   at com.google.maps.api.android.lib6.gmm6.store.k.a(k.java:96)
   at com.google.maps.api.android.lib6.gmm6.store.f.handleMessage(f.java:71)
   at android.os.Handler.dispatchMessage(Handler.java:111)
   at android.os.Looper.loop(Looper.java:194)
   at com.google.maps.api.android.lib6.gmm6.store.k.run(k.java:126)
   at com.google.maps.api.android.lib6.gmm6.store.ab.run(ab.java:12)

所有这些都发生在Android 5上,主要在Lenovo设备上.

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

地图已加载到SupportMapFragment中.

依赖关系(当前最新):

Dependencies (current latest):

com.google.android.gms:play-services-maps:17.0.0

com.google.maps.android:android-maps-utils:0.6.2

这次崩溃的原因可能是什么?

What could be the cause of this crash?

推荐答案

好,所以我在Google问题跟踪器上打开了一张票,许多人确认他们正面临同样的崩溃.

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:

对我有用的解决方法是在 等于16的地图,并在调用时使用16作为缩放级别 newLatLngZoom方法.似乎仅当您尝试时才会出现此问题 缩放超过16个级别.

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.

更新:

根据Google的描述,该崩溃已修复为将来的SDK版本.

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

经进一步检查,我们的工程团队能够复制 问题,并已在最新的SDK版本中修复.

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

这篇关于Google Maps崩溃:java.lang.NullPointerException:尝试从空数组读取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆