You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Flutter集成Google Maps时GLThread空指针崩溃问题求助

Flutter集成Google Maps时的FrameTime日志与致命崩溃问题

控制台持续输出日志:

I/Counters( 6851): exceeded sample count in FrameTime

随后触发如下致命崩溃:

E/AndroidRuntime( 6851): FATAL EXCEPTION: GLThread 123
E/AndroidRuntime( 6851): Process: estibafy.com.estibafy_user, PID: 6851
E/AndroidRuntime( 6851): java.lang.NullPointerException: Attempt to get length of null array
E/AndroidRuntime( 6851):    at java.nio.ByteBufferAsIntBuffer.put(ByteBufferAsIntBuffer.java:122)
E/AndroidRuntime( 6851):    at com.google.maps.api.android.lib6.gmm6.vector.gl.buffer.n.i(:com.google.android.gms.dynamite_mapsdynamite@214218120@21.42.18 (190800-0):2)
E/AndroidRuntime( 6851):    at com.google.maps.api.android.lib6.gmm6.vector.gl.buffer.n.d(:com.google.android.gms.dynamite_mapsdynamite@214218120@21.42.18 (190800-0):3)
E/AndroidRuntime( 6851):    at com.google.maps.api.android.lib6.gmm6.vector.gl.drawable.d.s(:com.google.android.gms.dynamite_mapsdynamite@214218120@21.42.18 (190800-0):3)
E/AndroidRuntime( 6851):    at com.google.maps.api.android.lib6.gmm6.vector.gl.drawable.ao.s(:com.google.android.gms.dynamite_mapsdynamite@214218120@21.42.18 (190800-0):9)
E/AndroidRuntime( 6851):    at com.google.maps.api.android.lib6.gmm6.vector.bz.s(:com.google.android.gms.dynamite_mapsdynamite@214218120@21.42.18 (190800-0):29)
E/AndroidRuntime( 6851):    at com.google.maps.api.android.lib6.gmm6.vector.bs.b(:com.google.android.gms.dynamite_mapsdynamite@214218120@21.42.18 (190800-0):151)
E/AndroidRuntime( 6851):    at com.google.maps.api.android.lib6.gmm6.vector.av.run(:com.google.android.gms.dynamite_mapsdynamite@214218120@21.42.18 (190800-0):48)
D/EGL_emulation( 6851): app_time_stats: avg=2145.86ms min=60.17ms max=14501.58ms count=7
I/Process ( 6851): Sending signal. PID: 6851 SIG: 9

解决方案

  • 升级Google Maps Flutter插件到最新稳定版:修改pubspec.yaml中的google_maps_flutter版本为最新稳定版,执行flutter pub get更新依赖
  • 清理重建项目:依次执行flutter clean、flutter pub get,再重新编译运行
  • 检查自定义地图元素:如果使用了自定义Marker、Polyline或Overlay,确认关联的资源(图片、坐标数据等)不为null,避免传入无效数据导致GL线程异常
  • 降级插件版本(临时方案):若最新版插件问题未解决,可尝试降级到之前的稳定版本(比如2.5.0),验证是否修复崩溃
  • 关闭硬件加速(极端排查手段):在AndroidManifest.xml的application标签添加android:hardwareAccelerated="false",但会影响地图性能,仅用于排查问题

内容的提问来源于stack exchange,提问作者Shazaib Danish

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.16 16:21:01