Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maps clustering: DefaultClusterRenderer crashes when setting an icon #257

Closed
BorisLaskov opened this issue Jan 20, 2023 · 5 comments
Closed
Assignees
Labels
needs more info This issue needs more information from the customer to proceed. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@BorisLaskov
Copy link

DefaultClusterRenderer crashes when clicking on a marker and going to another Fragment and/or returning back the Fragment with map. I am not sure if it a problem with Compose lifecycle this library wraps Google Maps with, or it is a general problem with Google Maps. I've seen a similar issue here, if it is not a problem with Compose, then I will open a new issue in that project.

I have copied and slightly modified the demo project to reproduce the issue, you can find it here

  1. Open "Map Clustering"
  2. Tap on an item to open another Fragment
  3. Tap "Back" to return to the map
  4. Move map, tap on any other item, go back, etc.

Eventually, the app will crash with the following stacktrace:

java.lang.IllegalArgumentException: Unmanaged descriptor
   	at com.google.maps.api.android.lib6.common.m.c(:com.google.android.gms.dynamite_mapsdynamite@225014045@22.50.14 (190408-0):0)
    at com.google.maps.api.android.lib6.impl.w.c(:com.google.android.gms.dynamite_mapsdynamite@225014045@22.50.14 (190408-0):1)
    at com.google.maps.api.android.lib6.impl.cy.u(:com.google.android.gms.dynamite_mapsdynamite@225014045@22.50.14 (190408-0):2)
    at com.google.android.gms.maps.model.internal.p.ba(:com.google.android.gms.dynamite_mapsdynamite@225014045@22.50.14 (190408-0):42)
    at fd.onTransact(:com.google.android.gms.dynamite_mapsdynamite@225014045@22.50.14 (190408-0):4)
    at android.os.Binder.transact(Binder.java:1084)
    at com.google.android.gms.internal.maps.zza.zzc(com.google.android.gms:play-services-maps@@18.0.0:2)
    at com.google.android.gms.internal.maps.zzv.zzs(com.google.android.gms:play-services-maps@@18.0.0:3)
    at com.google.android.gms.maps.model.Marker.setIcon(com.google.android.gms:play-services-maps@@18.0.0:2)
    at com.google.maps.android.compose.GoogleMarkerRenderer.onClusterItemUpdated(GoogleMarkerRenderer.kt:43)
    at com.google.maps.android.compose.GoogleMarkerRenderer.onClusterItemUpdated(GoogleMarkerRenderer.kt:12)
    at com.google.maps.android.clustering.view.DefaultClusterRenderer$CreateMarkerTask.perform(DefaultClusterRenderer.java:1060)
    at com.google.maps.android.clustering.view.DefaultClusterRenderer$CreateMarkerTask.access$2400(DefaultClusterRenderer.java:1021)
    at com.google.maps.android.clustering.view.DefaultClusterRenderer$MarkerModifier.performNextTask(DefaultClusterRenderer.java:738)
    at com.google.maps.android.clustering.view.DefaultClusterRenderer$MarkerModifier.handleMessage(DefaultClusterRenderer.java:707)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loopOnce(Looper.java:233)
    at android.os.Looper.loop(Looper.java:344)
    at android.app.ActivityThread.main(ActivityThread.java:8248)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:589)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1071)

Maps Compose v2.8.1, Maps v3.3.0, Maps Utils v2.3.0, Play Services v18.0.2; tested on OnePlus Nord 2, Android 12

@BorisLaskov BorisLaskov added triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Jan 20, 2023
@wangela
Copy link
Member

wangela commented Jan 20, 2023

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

@DSteve595
Copy link
Contributor

Appreciate the repro project.
I'm personally not able to repro. Could you let me know what kind of device/emulator you're using so I can try to match your setup more closely?
I'd also be curious to know if you still encounter this issue using the work-in-progress Clustering API in #258.

@DSteve595 DSteve595 added needs more info This issue needs more information from the customer to proceed. and removed triage me I really want to be triaged. labels Feb 13, 2023
@BorisLaskov
Copy link
Author

I am using Oneplus Nord 2 with Android 12. Our tester has also encountered this issue on Redmi Note 5 with Android 13. Unfortunately, I have not had time to test the new experimental Compose API you mention, but I will try it if I have a chance

@DSteve595
Copy link
Contributor

DSteve595 commented Feb 27, 2023

It'd be very much appreciated if you could test it with the Clustering API. The icon rendering is totally reworked. The MapEffect+ClusteringManager is no longer supported (no current plans to remove it, but it's superseded by Clustering).
Closing for now, but happy to reopen if it still repros.

@sterea16
Copy link

sterea16 commented Mar 29, 2023

For me this issue it's still replicating. I am using Android API 33.
In my scenario I have one favorite marker which the user needs to see outside the clusters. I add it by using the cluster manager's marker manager like this:

val oneItemCollection = clusterManager.markerManager.newCollection()

favoriteMarker = oneItemCollection.addMarker(markerOptions)
oneItemCollection.setOnMarkerClickListener {
      handleOnMarkerClicked(markerInfo)
      false
}

I need to add it like this because I want to have a proper click listener.
The crash comes when the user is changing this favorit marker with another one inside a cluster but only sometimes, there is no pattern I can find to be sure it will replicate 100% sure.

Please note that there is no map movement involved in my case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs more info This issue needs more information from the customer to proceed. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

4 participants