Navigation: I forgot to declare the default value ...
# compose
j
Navigation: I forgot to declare the default value of an optional parameter and when I tried to navigate (without providing the parameter) the app got stuck. When I tried to perform another action it crashed with a stacktrace that does not point to the app code and does not help find the issue (I attach it in the thread).  • It would be helpful if the app crashes right away and with a descriptive message 🙂 • Also, it would be nice if how to provide optional parameters or how to skip them was explained here.
Copy code
java.lang.NullPointerException
    at androidx.compose.foundation.gestures.DragGestureDetectorKt.awaitVerticalTouchSlopOrCancellation-jO51t88(DragGestureDetector.kt:742)
    at androidx.compose.foundation.gestures.DragGestureDetectorKt$awaitVerticalTouchSlopOrCancellation$1.invokeSuspend(Unknown Source:15)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTaskKt.resume(DispatchedTask.kt:178)
    at kotlinx.coroutines.DispatchedTaskKt.dispatch(DispatchedTask.kt:166)
    at kotlinx.coroutines.CancellableContinuationImpl.dispatchResume(CancellableContinuationImpl.kt:362)
    at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl(CancellableContinuationImpl.kt:396)
    at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl$default(CancellableContinuationImpl.kt:388)
    at kotlinx.coroutines.CancellableContinuationImpl.resumeWith(CancellableContinuationImpl.kt:293)
    at androidx.compose.ui.input.pointer.SuspendingPointerInputFilter$PointerEventHandlerCoroutine.offerPointerEvent(SuspendingPointerInputFilter.kt:421)
    at androidx.compose.ui.input.pointer.SuspendingPointerInputFilter.dispatchPointerEvent(SuspendingPointerInputFilter.kt:318)
    at androidx.compose.ui.input.pointer.SuspendingPointerInputFilter.onPointerEvent-H0pRuoY(SuspendingPointerInputFilter.kt:331)
    at androidx.compose.ui.input.pointer.Node.dispatchToPointerInputFilter(HitPathTracker.kt:360)
    at androidx.compose.ui.input.pointer.Node.dispatchChanges(HitPathTracker.kt:308)
    at androidx.compose.ui.input.pointer.Node.dispatchChanges(HitPathTracker.kt:304)
    at androidx.compose.ui.input.pointer.NodeParent.dispatchChanges(HitPathTracker.kt:179)
    at androidx.compose.ui.input.pointer.HitPathTracker.dispatchChanges(HitPathTracker.kt:111)
    at androidx.compose.ui.input.pointer.PointerInputEventProcessor.process-gBdvCQM(PointerInputEventProcessor.kt:80)
    at androidx.compose.ui.platform.AndroidComposeView.dispatchTouchEvent(AndroidComposeView.android.kt:683)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3143)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2757)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3143)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2757)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3143)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2757)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3143)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2757)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3143)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2757)
    at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3143)
    at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2757)
    at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:494)
    at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1894)
    at android.app.Activity.dispatchTouchEvent(Activity.java:4131)
    at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69)
    at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:452)
    at android.view.View.dispatchPointerEvent(View.java:14648)
    at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:6443)
    at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:6214)
    at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5680)
    at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5737)
    at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5703)
    at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5855)
    at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5711)
2021-02-28 18:27:19.560 28639-28639/com.pose.composingclocks E/AndroidRuntime:   at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5912)
    at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5684)
    at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5737)
    at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5703)
    at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5711)
    at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5684)
    at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:8584)
    at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:8535)
    at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:8433)
    at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:8707)
    at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:221)
    at android.os.MessageQueue.nativePollOnce(Native Method)
    at android.os.MessageQueue.next(MessageQueue.java:335)
    at android.os.Looper.loop(Looper.java:183)
    at android.app.ActivityThread.main(ActivityThread.java:8010)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:631)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:978)
a
Please file this trace with some repro steps with the issue tracker if you can; we certainly shouldn't be throwing these from the input framework
i
Can you explain what you mean by "it would be nice if how to provide optional parameters or how to skip them was explained"? Was it that query parameter syntax wasn't a term you were familiar with? What did you try before figuring out the right way to handle optional arguments?
j
Yes @Ian Lake the problem was that I wasn’t familiar with the “query parameter syntax” term 😅 I started trying not to pass a default value, and as I had forgotten to declare the default, it didn’t work. So I though the problem was that I didn’t know how to call navigate with optional parameters and it took me some searching. It’s my fault and it may not be a frequent issue. I just thought it would be a bit easier to understand with a simple example, like in non-optional arguments.
👍 1
I created a an issue with the stacktrace: https://issuetracker.google.com/issues/181680103
i
Can you attach a sample project that reproduces your issue to that issue?