Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

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@[email protected] (040400-271418971):20)
   at com.google.maps.api.android.lib6.gmm6.vector.gl.buffer.o.d(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (040400-271418971):36)
   at com.google.maps.api.android.lib6.gmm6.vector.gl.drawable.a.a(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (040400-271418971):66)
   at com.google.maps.api.android.lib6.gmm6.vector.gl.drawable.ao.a(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (040400-271418971):227)
   at com.google.maps.api.android.lib6.gmm6.vector.cl.a(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (040400-271418971):274)
   at com.google.maps.api.android.lib6.gmm6.vector.bz.a(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (040400-271418971):359)
   at com.google.maps.api.android.lib6.gmm6.vector.bg.run(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (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. I searched for days and found nothing. can anybody point me what might be the problem ?

like image 761
tomer wolinsky Avatar asked Nov 16 '22 23:11

tomer wolinsky


1 Answers

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. I think the issue is discussed here:

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

They mention an issue with Flutter 3 and recommend going back to Flutter 2.10.

**Edit: There is an opened issue in 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."

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!

like image 148
Jeremie Houet Avatar answered May 24 '23 01:05

Jeremie Houet