android-maps-compose icon indicating copy to clipboard operation
android-maps-compose copied to clipboard

NullPointerException java.nio.ByteBufferAsIntBuffer in put

Open mbarakacart opened this issue 2 years ago • 4 comments

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@[email protected] (150400-0):2)
   at com.google.maps.api.android.lib6.gmm6.vector.gl.buffer.n.d(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (150400-0):3)
   at com.google.maps.api.android.lib6.gmm6.vector.gl.drawable.d.s(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (150400-0):2)
   at com.google.maps.api.android.lib6.gmm6.vector.gl.drawable.ao.s(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (150400-0):12)
   at com.google.maps.api.android.lib6.gmm6.vector.bz.s(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (150400-0):29)
   at com.google.maps.api.android.lib6.gmm6.vector.bs.b(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (150400-0):151)
   at com.google.maps.api.android.lib6.gmm6.vector.av.run(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (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)
  }
}
  • Is there any issue remembering those properties?
  • I also remember the marker bitmapDescriptor, for the marker, can this cause an issue?
  • I also tried to disable the LaunchedEffect is the MapRow is not visible anymore using LazyListState.layoutInfo.visibleItemsInfo and looking for the row key

mbarakacart avatar Jan 30 '23 21:01 mbarakacart

@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.

wangela avatar Jan 30 '23 21:01 wangela

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'

sebj avatar Mar 10 '23 12:03 sebj

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.

mbarakacart avatar Mar 10 '23 16:03 mbarakacart

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@[email protected] (190408-0):6)
com.google.maps.api.android.lib6.gmm6.vector.gl.buffer.j.l (:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190408-0):31)
com.google.maps.api.android.lib6.gmm6.vector.gl.buffer.j.o (:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190408-0):5)
com.google.maps.api.android.lib6.gmm6.vector.gl.buffer.j.g (:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190408-0):22)
com.google.maps.api.android.lib6.gmm6.vector.gl.e.d (:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190408-0):45)
com.google.maps.api.android.lib6.gmm6.vector.gl.drawable.d.s (:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190408-0):28)
com.google.maps.api.android.lib6.gmm6.vector.gl.drawable.ao.s (:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190408-0):171)
com.google.maps.api.android.lib6.gmm6.vector.bx.s (:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190408-0):533)
com.google.maps.api.android.lib6.gmm6.vector.bq.b (:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190408-0):2337)
com.google.maps.api.android.lib6.gmm6.vector.at.run (:com.google.android.gms.dynamite_mapsdynamite@[email protected] (190408-0):774)

mathemandy avatar Sep 17 '23 22:09 mathemandy