Android crash when displaying a custom marker info window using markerInfoContents
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 92/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- android, typescript
- Domain
- mobile-dev
Research direction
Start in packages/google-maps/index.android.ts at the markerInfoContents handling that adds info.view to a GridLayout. Verify the returned native view is the wrapper container, then reproduce by repeatedly opening markers and confirm custom information windows no longer trigger the already-parented-child crash on Android.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- TypeScript
- Stars
- 206
- Forks
- 123
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from NativeScript/plugins
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
NativeScript/plugins#671 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
NativeScript/plugins#640 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
NativeScript/plugins#668 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
NativeScript/plugins#665 · 1 comment ·
-
NativeScript/plugins#660 · 1 reaction · 2 assignees ·
All issues in NativeScript/plugins
Similar issues
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100