googlemaps / android-maps-compose

Jetpack Compose composables for the Maps SDK for Android
https://developers.google.com/maps/documentation/android-sdk/maps-compose
Apache License 2.0
1.15k stars 135 forks source link

NullPointerException java.nio.ByteBufferAsIntBuffer in put #260

Open mbarakacart opened 1 year ago

mbarakacart commented 1 year ago

Environment details

happening with Android 8, 9, 10, 11, 12 I believe it started at 2.7.2, but right now I have 2.8.0

Steps to reproduce

Unfortunately I was able to do it only once, it happened when I scrolled down programmatically in LazyColumn using scrollState.animateScrollToItem(), which cause the map to disappear. I am not sure if the map was trying to move camera at that time or not though.

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.n.i(:com.google.android.gms.dynamite_mapsdynamite@230313037@23.03.13 (150400-0):2)
    at com.google.maps.api.android.lib6.gmm6.vector.gl.buffer.n.d(:com.google.android.gms.dynamite_mapsdynamite@230313037@23.03.13 (150400-0):3)
    at com.google.maps.api.android.lib6.gmm6.vector.gl.drawable.d.s(:com.google.android.gms.dynamite_mapsdynamite@230313037@23.03.13 (150400-0):2)
    at com.google.maps.api.android.lib6.gmm6.vector.gl.drawable.ao.s(:com.google.android.gms.dynamite_mapsdynamite@230313037@23.03.13 (150400-0):12)
    at com.google.maps.api.android.lib6.gmm6.vector.bz.s(:com.google.android.gms.dynamite_mapsdynamite@230313037@23.03.13 (150400-0):29)
    at com.google.maps.api.android.lib6.gmm6.vector.bs.b(:com.google.android.gms.dynamite_mapsdynamite@230313037@23.03.13 (150400-0):151)
    at com.google.maps.api.android.lib6.gmm6.vector.av.run(:com.google.android.gms.dynamite_mapsdynamite@230313037@23.03.13 (150400-0):48)

Code example

LazyColumn () {
 GoogleMapRow(mapViewState)
}
@Composable
fun GoogleMapRow(mapViewState) {
  val mapProperties = remember(mapViewState) { mutableStateOf(MapProperties(......) } 
  val mapUiSettings = remember(mapViewState) { mutableStateOf(MapUiSettings(......) } 
  val mapOptions = remember(mapViewState) { mutableStateOf(GoogleMapOptions(......) } 
  val isMapLoaded = remember(mapViewState) { mutableStateOf(false) } 

  GoogleMap(
  Modifier.defaultMinSize(minWidth = 50.dp, minHeight = 30.dp), 
  cameraPositionState,
  mapProperties, mapUiSettings,
  googleMapOptionsFactory = { mapOptions },
 onMapLoaded = { isMapLoaded.value = true },
) {
  // loop on Marker list
}

 LaunchedEffect(key1 = isMapLoaded.value) {
     // cameraPositionState.move(update)
    // cameraPositionState.animated(update, 1000)
  }
}
wangela commented 1 year ago

@mbarakacart Thank you for opening this issue. 🙏 Please check out these other resources that might help you get to a resolution in the meantime:

This is an automated message, feel free to ignore.

sebj commented 1 year ago

I'm also seeing the same unhandled exception crash. I believe it matches the following issue in Google's public issue tracker is relevant: https://issuetracker.google.com/issues/237380999?pli=1, which is marked as 'fixed'

mbarakacart commented 1 year ago

I'm also seeing the same unhandled exception crash. I believe it matches the following issue in Google's public issue tracker is relevant: https://issuetracker.google.com/issues/237380999?pli=1, which is marked as 'fixed'

I believe you are right, we tested using the new renderer for a while and we saw improvement, but unfortunately we started seeing another issue where the MapMarker are breaking and found a Google issue here.

This current issue however seems to be happening with Compose + GMap (we have the compose map in LazyColumn). While the Marker issue is happening with non compose map + new renderer.

mathemandy commented 1 year ago

Started to get the same issue in our compose map screen in a lazy column as well


com.google.maps.api.android.lib6.gmm6.vector.gl.buffer.g.n (:com.google.android.gms.dynamite_mapsdynamite@233116045@23.31.16 (190408-0):6)
com.google.maps.api.android.lib6.gmm6.vector.gl.buffer.j.l (:com.google.android.gms.dynamite_mapsdynamite@233116045@23.31.16 (190408-0):31)
com.google.maps.api.android.lib6.gmm6.vector.gl.buffer.j.o (:com.google.android.gms.dynamite_mapsdynamite@233116045@23.31.16 (190408-0):5)
com.google.maps.api.android.lib6.gmm6.vector.gl.buffer.j.g (:com.google.android.gms.dynamite_mapsdynamite@233116045@23.31.16 (190408-0):22)
com.google.maps.api.android.lib6.gmm6.vector.gl.e.d (:com.google.android.gms.dynamite_mapsdynamite@233116045@23.31.16 (190408-0):45)
com.google.maps.api.android.lib6.gmm6.vector.gl.drawable.d.s (:com.google.android.gms.dynamite_mapsdynamite@233116045@23.31.16 (190408-0):28)
com.google.maps.api.android.lib6.gmm6.vector.gl.drawable.ao.s (:com.google.android.gms.dynamite_mapsdynamite@233116045@23.31.16 (190408-0):171)
com.google.maps.api.android.lib6.gmm6.vector.bx.s (:com.google.android.gms.dynamite_mapsdynamite@233116045@23.31.16 (190408-0):533)
com.google.maps.api.android.lib6.gmm6.vector.bq.b (:com.google.android.gms.dynamite_mapsdynamite@233116045@23.31.16 (190408-0):2337)
com.google.maps.api.android.lib6.gmm6.vector.at.run (:com.google.android.gms.dynamite_mapsdynamite@233116045@23.31.16 (190408-0):774)