Status Update
Comments
sm...@google.com <sm...@google.com> #2
Now, instead of crashing, we ignore invalid deep links, printing a log message saying as much.
ap...@google.com <ap...@google.com> #3
The problem still occurs on version 2.2.0-rc04
je...@gmail.com <je...@gmail.com> #4
je...@gmail.com <je...@gmail.com> #5
ap...@google.com <ap...@google.com> #6
sm...@google.com <sm...@google.com> #7
sm...@google.com <sm...@google.com> #8
NavDestination node = i == 0 ? mGraph : graph.findNode(destinationId);
if deepLink.length == 1 node never will be null and this will cause IllegalStateException
Bug demo:
get NavigationAdvancedSample from github
on R.id.about_btn click
NavDeepLinkBuilder(it.context)
.setGraph(R.navigation.list)
.setDestination(R.id.leaderboard)
.createTaskStackBuilder()
.startActivities()
will crash because R.id.leaderboard is start destination (findInvalidDestinationDisplayNameInDeepLink will have deepLink length == 1)
NavDeepLinkBuilder(it.context)
.setGraph(R.navigation.list)
.setDestination(R.id.userProfile)
.createTaskStackBuilder()
.startActivities()
will work because findInvalidDestinationDisplayNameInDeepLink will return NOT null
sh...@google.com <sh...@google.com>
al...@gmail.com <al...@gmail.com> #9
It still crash with the latest version 2.2.1. I think the problem lies somewhere around this code
NavDestination node = i == 0 ? mGraph : graph.findNode(destinationId);
When i
is 0
, just return mGraph
itself. When the deep link destination is a root of bottom_nav tab, the deeplink.length
becomes 1. Which means this function still says there's no invalid Destination in deep link even if deepLink[0]
is totally irrelevant tomGraph
.
So this step passes and when findDestination() is actually triggered down the road, it won't find any destination and thus lead to unknown destination
crash.
All NavControllers of bottom nav automatically call handleDeepLink()
as part of onGraphCreated()
. The problem arises the moment NavController whose graph is irrelevant to the root deep link destination calls handleDeepLink()
.
sm...@google.com <sm...@google.com> #10
It still crashes with 2.3.0-alpha03 version but only if you try to deeplink to startDestination fragment inside navigation graph. Repro steps (described in #8, but lets repeat it in hope issue will be reopened):
- download NavigationAdvancedSample
- send pending intent to any startDestination screen, e.g.
val pendingIntent = NavDeepLinkBuilder(applicationContext)
.setGraph(R.navigation.list)
.setDestination(R.id.leaderboard)
.setArguments(bundle) // no matter if it is empty in this use case
.createPendingIntent()
pendingIntent.send()
Exception:
Caused by: java.lang.IllegalStateException: unknown destination during deep link: com.example.android.navigationadvancedsample:id/list
at androidx.navigation.NavController.handleDeepLink(NavController.java:689)
at androidx.navigation.NavController.onGraphCreated(NavController.java:602)
at androidx.navigation.NavController.setGraph(NavController.java:563)
at androidx.navigation.NavController.setGraph(NavController.java:528)
at androidx.navigation.fragment.NavHostFragment.onCreate(NavHostFragment.java:246)
at androidx.fragment.app.Fragment.performCreate(Fragment.java:2684)
at androidx.fragment.app.FragmentStateManager.create(FragmentStateManager.java:280)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1175)
at androidx.fragment.app.FragmentTransition.addToFirstInLastOut(FragmentTransition.java:1255)
at androidx.fragment.app.FragmentTransition.calculateFragments(FragmentTransition.java:1138)
at androidx.fragment.app.FragmentTransition.startTransitions(FragmentTransition.java:136)
at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1989)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1947)
at androidx.fragment.app.FragmentManager.execSingleAction(FragmentManager.java:1818)
at androidx.fragment.app.BackStackRecord.commitNow(BackStackRecord.java:297)
at com.example.android.navigationadvancedsample.NavigationExtensionsKt.obtainNavHostFragment(NavigationExtensions.kt:269)
at com.example.android.navigationadvancedsample.NavigationExtensionsKt.setupWithNavController(NavigationExtensions.kt:61)
at com.example.android.navigationadvancedsample.MainActivity.setupBottomNavigationBar(MainActivity.kt:121)
at com.example.android.navigationadvancedsample.MainActivity.onCreate(MainActivity.kt:54)
Reopening would be a good sign that issue is recognized.
Description
Fatal Exception: java.lang.IllegalStateException: Range start point not set.
at androidx.core.util.Preconditions.checkState(SourceFile:96)
at androidx.recyclerview.selection.DefaultSelectionTracker.extendProvisionalRange(SourceFile:281)
at androidx.recyclerview.selection.GestureSelectionHelper.extendSelection(SourceFile:227)
at androidx.recyclerview.selection.GestureSelectionHelper.handleMoveEvent(SourceFile:204)
at androidx.recyclerview.selection.GestureSelectionHelper.handleTouch(SourceFile:151)
at androidx.recyclerview.selection.GestureSelectionHelper.onTouchEvent(SourceFile:125)
at androidx.recyclerview.selection.TouchEventRouter.onTouchEvent(SourceFile:103)
at androidx.recyclerview.widget.RecyclerView.dispatchToOnItemTouchListeners(SourceFile:3035)
at android.view.View.dispatchTouchEvent(View.java:10775)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2859)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2535)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550)
at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:568)
at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1896)
at android.app.Activity.dispatchTouchEvent(Activity.java:3247)
at com.supercilex.robotscouter.core.ui.ActivityBase.dispatchTouchEvent(SourceFile:82)
at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(SourceFile:69)
at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(SourceFile:69)
at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:530)
at android.view.View.dispatchPointerEvent(View.java:11004)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:5111)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4963)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4494)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4547)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4513)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4646)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4521)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4703)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4494)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4547)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4513)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4521)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4494)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:7003)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6934)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6895)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:7113)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(InputEventReceiver.java)
at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:176)
at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:7077)
at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:7140)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:927)
at android.view.Choreographer.doCallbacks(Choreographer.java:702)
at android.view.Choreographer.doFrame(Choreographer.java:632)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:913)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6836)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)