google / ground-android

Ground mobile data collection app for Android
http://groundplatform.org
Apache License 2.0
244 stars 114 forks source link

App Crash after Data Submission #2711

Open anandwana001 opened 2 weeks ago

anandwana001 commented 2 weeks ago
Process: com.google.android.ground, PID: 1692
                                                                                                    java.lang.IllegalArgumentException: Navigation action/destination com.google.android.ground:id/action_home_screen_fragment_to_dataCollectionFragment cannot be found from the current destination Destination(com.google.android.ground:id/submissionConfirmationDialogFragment) label=DataSubmittedConfirmationDialogFragment
                                                                                                        at androidx.navigation.NavController.navigate(NavController.kt:1691)
                                                                                                        at androidx.navigation.NavController.navigate(NavController.kt:1609)
                                                                                                        at androidx.navigation.NavController.navigate(NavController.kt:2169)
                                                                                                        at com.google.android.ground.MainActivity.onNavigate(MainActivity.kt:157)
                                                                                                        at com.google.android.ground.MainActivity.access$onNavigate(MainActivity.kt:56)
                                                                                                        at com.google.android.ground.MainActivity$onCreate$2$1.emit(MainActivity.kt:82)
                                                                                                        at com.google.android.ground.MainActivity$onCreate$2$1.emit(MainActivity.kt:82)
                                                                                                        at kotlinx.coroutines.flow.SharedFlowImpl.collect$suspendImpl(SharedFlow.kt:382)
                                                                                                        at kotlinx.coroutines.flow.SharedFlowImpl$collect$1.invokeSuspend(Unknown Source:15)
                                                                                                        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
                                                                                                        at kotlinx.coroutines.DispatchedTaskKt.resume(DispatchedTask.kt:235)
                                                                                                        at kotlinx.coroutines.DispatchedTaskKt.resumeUnconfined(DispatchedTask.kt:191)
                                                                                                        at kotlinx.coroutines.DispatchedTaskKt.dispatch(DispatchedTask.kt:163)
                                                                                                        at kotlinx.coroutines.CancellableContinuationImpl.dispatchResume(CancellableContinuationImpl.kt:474)
                                                                                                        at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl(CancellableContinuationImpl.kt:508)
                                                                                                        at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl$default(CancellableContinuationImpl.kt:497)
                                                                                                        at kotlinx.coroutines.CancellableContinuationImpl.resumeWith(CancellableContinuationImpl.kt:368)
                                                                                                        at kotlinx.coroutines.flow.SharedFlowImpl.tryEmit(SharedFlow.kt:399)
                                                                                                        at kotlinx.coroutines.flow.SharedFlowImpl.emit$suspendImpl(SharedFlow.kt:404)
                                                                                                        at kotlinx.coroutines.flow.SharedFlowImpl.emit(Unknown Source:0)
                                                                                                        at kotlinx.coroutines.flow.SharedFlowImpl.collect$suspendImpl(SharedFlow.kt:382)
                                                                                                        at kotlinx.coroutines.flow.SharedFlowImpl$collect$1.invokeSuspend(Unknown Source:15)
                                                                                                        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
                                                                                                        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
                                                                                                        at android.os.Handler.handleCallback(Handler.java:959)
                                                                                                        at android.os.Handler.dispatchMessage(Handler.java:100)
                                                                                                        at android.os.Looper.loopOnce(Looper.java:232)
                                                                                                        at android.os.Looper.loop(Looper.java:317)
                                                                                                        at android.app.ActivityThread.main(ActivityThread.java:8674)
                                                                                                        at java.lang.reflect.Method.invoke(Native Method)
                                                                                                        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
                                                                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:886)
                                                                                                        Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [Sta
shobhitagarwal1612 commented 1 day ago

The stacktrace seems incomplete. It doesn't show where the navigation request originated from.

shobhitagarwal1612 commented 1 day ago

From the error in bug description, we can deduce that the user was trying to open "DataCollectionFragment" while on the "SubmissionConfirmationDialog" which is not possible. DataCollectionFragment can only be navigated to from HomeScreen.

Currently, one can open the DataCollectionFragment in 2 ways:

  1. Clicking the LOI Card (existing LOI or new LOI)
  2. Reopening the HomeScreenFragment with a draft value which automatically open the "dataCollectionFragment" with the draft values.
shobhitagarwal1612 commented 1 day ago

My guess is that the issue is happening due to path 2. Somehow the draft is not getting cleared after submitting the data which is resulting in attempting to reopen the data collection screen.