简体   繁体   English

谷歌地图 api 获得致命异常:java.lang.NullPointerException:尝试获取 null 数组的长度

[英]Google maps api gets Fatal Exception: java.lang.NullPointerException: Attempt to get length of null array

Sometimes like 50% of the time on my map activity i get this error:有时在我的 map 活动中,有 50% 的时间出现此错误:

Fatal Exception: java.lang.NullPointerException: Attempt to get length of null array
   at java.nio.ByteBufferAsIntBuffer.put(ByteBufferAsIntBuffer.java:122)
   at com.google.maps.api.android.lib6.gmm6.vector.gl.buffer.o.e(:com.google.android.gms.dynamite_mapsdynamite@19420048@19.4.20 (040400-271418971):20)
   at com.google.maps.api.android.lib6.gmm6.vector.gl.buffer.o.d(:com.google.android.gms.dynamite_mapsdynamite@19420048@19.4.20 (040400-271418971):36)
   at com.google.maps.api.android.lib6.gmm6.vector.gl.drawable.a.a(:com.google.android.gms.dynamite_mapsdynamite@19420048@19.4.20 (040400-271418971):66)
   at com.google.maps.api.android.lib6.gmm6.vector.gl.drawable.ao.a(:com.google.android.gms.dynamite_mapsdynamite@19420048@19.4.20 (040400-271418971):227)
   at com.google.maps.api.android.lib6.gmm6.vector.cl.a(:com.google.android.gms.dynamite_mapsdynamite@19420048@19.4.20 (040400-271418971):274)
   at com.google.maps.api.android.lib6.gmm6.vector.bz.a(:com.google.android.gms.dynamite_mapsdynamite@19420048@19.4.20 (040400-271418971):359)
   at com.google.maps.api.android.lib6.gmm6.vector.bg.run(:com.google.android.gms.dynamite_mapsdynamite@19420048@19.4.20 (040400-271418971):85)

I dont have a clue what might be the problem, sometimes its working and sometimes it gives me that error, especially on my LG g6.我不知道可能是什么问题,有时它可以工作,有时它会给我这个错误,尤其是在我的 LG g6 上。 I searched for days and found nothing.我找了几天,一无所获。 can anybody point me what might be the problem?谁能指出我可能是什么问题?

I have the same error showing on my flutter app when I leave the screen with the map and get back to it too quickly.当我使用 map 离开屏幕并过快返回时,我的 flutter 应用程序上显示了相同的错误。 I think the issue is discussed here:我认为这个问题在这里讨论:

https://issuehint.com/issue/flutter/flutter/105584 https://issuehint.com/issue/flutter/flutter/105584

They mention an issue with Flutter 3 and recommend going back to Flutter 2.10.他们提到了 Flutter 3 的问题,并建议返回到 Flutter 2.10。

**Edit: There is an opened issue in Github: https://github.com/flutter/flutter/issues/105965 **编辑:Github 中有一个未解决的问题: https://github.com/flutter/flutter/issues/105965

One of the user says:一位用户说:

"So far the only thing I could come up with is to add — on the screen using the GoogleMap widget — a delay to the Navigator.pop + denying the user to do anything in the meanwhile." “到目前为止,我唯一能想到的就是在屏幕上使用 GoogleMap 小部件添加一个延迟到 Navigator.pop + 拒绝用户在此期间做任何事情。”

Future<void> _delayedPop(BuildContext context) async {
  unawaited(
    Navigator.of(context, rootNavigator: true).push(
      PageRouteBuilder(
        pageBuilder: (_, __, ___) => WillPopScope(
          onWillPop: () async => false,
          child: Scaffold(
            backgroundColor: Colors.transparent,
            body: const Center(
              child: CircularProgressIndicator.adaptive(),
            ),
          ),
        ),
        transitionDuration: Duration.zero,
        barrierDismissible: false,
        barrierColor: Colors.black45,
        opaque: false,
      ),
    ),
  );
  await Future.delayed(const Duration(seconds: 1));
  Navigator.of(context)
    ..pop()
    ..pop();
}

I am not sure it is the issue in your case since you posted this thread 2 years ago but maybe it will help other people!我不确定这是你的问题,因为你在 2 年前发布了这个帖子,但也许它会帮助其他人!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android java.lang.NullPointerException:尝试获取空数组的长度 - Android java.lang.NullPointerException: Attempt to get length of null array 为什么google map v2突然崩溃了java.lang.NullPointerException:尝试获取null数组的长度? - Why google map v2 suddenly crashed by java.lang.NullPointerException: Attempt to get length of null array? java.lang.NullPointerException:尝试获取与“无法读取空数组”相关的空数组的长度 - java.lang.NullPointerException: Attempt to get length of null array related with 'can't read null array' 获取 java.lang.NullPointerException: Attempt to get length of null array 错误 - Getting java.lang.NullPointerException: Attempt to get length of null array error 致命异常:java.lang.NullPointerException:尝试在空对象引用onClickItem上调用虚方法void - FATAL EXCEPTION: java.lang.NullPointerException: Attempt to invoke virtual method void on a null object reference onClickItem 致命异常:java.lang.NullPointerException - Fatal Exception: java.lang.NullPointerException java.lang.NullPointerException:尝试从 null 数组读取,android 工作室 ZD521877880E1EA232 - java.lang.NullPointerException: Attempt to read from null array, android studio Java 数组为null的java.lang.NullPointerException - Null with Array java.lang.NullPointerException Android Java致命异常java.lang.NullPointerException - Android Java FATAL EXCEPTION java.lang.NullPointerException “java.lang.NullPointerException:尝试写入空数组”for int [] [] var = new int [m] [n] - “java.lang.NullPointerException: Attempt to write to null array” for int[][] var = new int[m][n]
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM