google / ground-platform

Ground hosted components: Web console, Cloud Functions, db config
http://groundplatform.org
Apache License 2.0
203 stars 83 forks source link

Consecutive geometry tasks fails to render (com.google.maps.api.android.lib6.impl.as cannot be cast to android.view.ViewGroup) #1828

Closed sufyanAbbasi closed 2 months ago

sufyanAbbasi commented 2 months ago

Describe the bug

Received the following error when two subsequent location tasks are being rendered: the map doesn't render and we see this in the stack trace:

java.lang.ClassCastException: com.google.maps.api.android.lib6.impl.as cannot be cast to android.view.ViewGroup
  at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:537)
  at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:272)
  at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1943)
  at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1839)
  at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1782)
  at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:565)
  at android.os.Handler.handleCallback(Handler.java:958)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loopOnce(Looper.java:205)
  at android.os.Looper.loop(Looper.java:294)
  at android.app.ActivityThread.main(ActivityThread.java:8177)
  at java.lang.reflect.Method.invoke(Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)

I placed breakpoints at the exact line where the crash occurs and inspected the thing that was failing to cast as a ViewGroup. It turns out that the crash happens when it tries to render the compass of all things!

It happens specifically when I try to render the DrawAreaTaskFragment before or after a drop pin LOI task.

When I just have a Draw Area LOI task and no other, then it seems to work

To Reproduce Steps to reproduce the behavior:

  1. Publish a survey with the default capture location task and then an ad-hoc LOI task (e.g. capture location again).
  2. Zoom in and start a job, then see that the first task, the default capture task, is broken with a white screen.

Expected behavior

  1. The map is rendered.
sufyanAbbasi commented 2 months ago

Sorry, filed in the wrong place