Skip to content

Android crash when displaying a custom marker info window using markerInfoContents #680

Description

@msajjid

Android crash when displaying a custom marker info window using markerInfoContents

Using markerInfoContents to display a custom NativeScript view causes Android to crash on API 36, API 37, and a physical Android device.

Error

java.lang.IllegalStateException:
The specified child already has a parent.
You must call removeView() on the child's parent first.

Cause

In packages/google-maps/index.android.ts, the plugin adds info.view to a GridLayout container but returns the child:

container.addChild(info.view)
return info.view.nativeView

Because the returned child already belongs to the container, Google Maps attempts to attach an already-parented view.

Suggested fix

Return the wrapper container instead:

return container.nativeView

The custom information-window view should display without crashing when repeatedly opening markers.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions