Fixed
Status Update
Comments
su...@google.com <su...@google.com> #2
I'd like to add that this automatic removal of the NavGraph at the top of the stack is also making it hard for me to implement proper lateral top-level navigation.
A practical case where this kind of navigation happens is with a Material Design bottom navigation bar, where I have a NavHost above the bottom bar.
Given this navigation scheme:
A - B (top-level)
B1 (first sub-level)
When starting the Activity, the back stack is
0. A
1. NavGraph
If I wanted to navigate to B laterally, I would do:
navController.popBackStack(R.id.navGraph, false)
navController.navigate(R.id.B)
But the resulting back stack is:
0. B
Now, navigating between top-level destinations actually works (though popBackStack returns false); the problem arises again if I navigate to B1:
0. B1
1. B
When navigating from B1 to a top-level destination like A, the stack becomes:
0. A
1. B1
2. B
That is, A is not a top-level destination in the back stack: if I press back from A, I intend to exit the app, but I'm taken back to B1.
It would be nice to have a fixed reference to the bottom of the stack. Right now I'm working around this with a horrible ` while (navController.popBackStack()) continue`.
A practical case where this kind of navigation happens is with a Material Design bottom navigation bar, where I have a NavHost above the bottom bar.
Given this navigation scheme:
A - B (top-level)
B1 (first sub-level)
When starting the Activity, the back stack is
0. A
1. NavGraph
If I wanted to navigate to B laterally, I would do:
navController.popBackStack(R.id.navGraph, false)
navController.navigate(R.id.B)
But the resulting back stack is:
0. B
Now, navigating between top-level destinations actually works (though popBackStack returns false); the problem arises again if I navigate to B1:
0. B1
1. B
When navigating from B1 to a top-level destination like A, the stack becomes:
0. A
1. B1
2. B
That is, A is not a top-level destination in the back stack: if I press back from A, I intend to exit the app, but I'm taken back to B1.
It would be nice to have a fixed reference to the bottom of the stack. Right now I'm working around this with a horrible ` while (navController.popBackStack()) continue`.
ra...@google.com <ra...@google.com> #3
Is this going to be fixed?
I have the same issue with a setup as follows:
Navigation graph.
<navigation xmlns:android="http://schemas.android.com/apk/res/android "
xmlns:app="http://schemas.android.com/apk/res-auto "
xmlns:tools="http://schemas.android.com/tools "
app:startDestination="@+id/startupGraph">
<navigation
android:id="@+id/startupGraph"
app:startDestination="@id/launcher_home">
<fragment
android:id="@+id/launcher_home"
android:name="com.example.android.codelabs.navigation.MainFragment"
android:label="@string/home"
tools:layout="@layout/main_fragment" />
</navigation>
<navigation
android:id="@+id/homeGraph"
app:startDestination="@id/flow_step_one">
<fragment
android:id="@+id/flow_step_one"
android:name="com.example.android.codelabs.navigation.FlowStepOneFragment"
tools:layout="@layout/flow_step_one_fragment" />
<fragment
android:id="@+id/flow_step_two"
android:name="com.example.android.codelabs.navigation.FlowStepTwoFragment"
tools:layout="@layout/flow_step_two_fragment" />
</navigation>
</navigation>
MainFragment.
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
view.findViewById<Button>(R.id.navigate_dest_bt).setOnClickListener{
Navigation.findNavController(it)
.navigate(R.id.homeGraph, null, NavOptions.Builder()
.setPopUpTo(R.id.startupGraph, false)
.build())
}
}
FlowStepOneFragment.
view.findViewById<View>(R.id.next_button).setOnClickListener {
Navigation.findNavController(it)
.navigate(R.id.flow_step_two, null, NavOptions.Builder()
.setPopUpTo(R.id.flow_step_one, true)
.build())
}
}
}
Causes the following error:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.android.codelabs.navigation, PID: 12579
java.lang.IllegalArgumentException: Navigator androidx.navigation.fragment.FragmentNavigator@d70ec6f reported navigation to unknown destination id com.example.android.codelabs.navigation:id/flow_step_two
I have the same issue with a setup as follows:
Navigation graph.
<navigation xmlns:android="
xmlns:app="
xmlns:tools="
app:startDestination="@+id/startupGraph">
<navigation
android:id="@+id/startupGraph"
app:startDestination="@id/launcher_home">
<fragment
android:id="@+id/launcher_home"
android:name="com.example.android.codelabs.navigation.MainFragment"
android:label="@string/home"
tools:layout="@layout/main_fragment" />
</navigation>
<navigation
android:id="@+id/homeGraph"
app:startDestination="@id/flow_step_one">
<fragment
android:id="@+id/flow_step_one"
android:name="com.example.android.codelabs.navigation.FlowStepOneFragment"
tools:layout="@layout/flow_step_one_fragment" />
<fragment
android:id="@+id/flow_step_two"
android:name="com.example.android.codelabs.navigation.FlowStepTwoFragment"
tools:layout="@layout/flow_step_two_fragment" />
</navigation>
</navigation>
MainFragment.
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
view.findViewById<Button>(R.id.navigate_dest_bt).setOnClickListener{
Navigation.findNavController(it)
.navigate(R.id.homeGraph, null, NavOptions.Builder()
.setPopUpTo(R.id.startupGraph, false)
.build())
}
}
FlowStepOneFragment.
view.findViewById<View>(R.id.next_button).setOnClickListener {
Navigation.findNavController(it)
.navigate(R.id.flow_step_two, null, NavOptions.Builder()
.setPopUpTo(R.id.flow_step_one, true)
.build())
}
}
}
Causes the following error:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.android.codelabs.navigation, PID: 12579
java.lang.IllegalArgumentException: Navigator androidx.navigation.fragment.FragmentNavigator@d70ec6f reported navigation to unknown destination id com.example.android.codelabs.navigation:id/flow_step_two
Description
Version used:alpha-08
Devices/Android versions reproduced on:
HP Slate 6 Voice Tab - android 4.4.2, model :HSTNH-B19C ,kernal version :3.4.39
Problem Description:
Work Manager Start working on previous night to morining when app is opens. I have removed the app in Task Manager
Open my app not started. I have to see log:
first :
09-26 10:41:36.014 17329-17329/com.impecsoft.SmartTrends D/DebugDB: Open
09-26 10:41:36.034 17329-17343/com.impecsoft.SmartTrends E/SQLiteConnection: open, nativeOpen
09-26 10:41:36.054 17329-17343/com.impecsoft.SmartTrends D/dalvikvm: GC_FOR_ALLOC freed 352K, 13% free 2979K/3412K, paused 11ms, total 11ms
09-26 10:41:36.074 17329-17343/com.impecsoft.SmartTrends E/SQLiteConnection: open, nativeOpen
09-26 10:41:36.094 17329-17343/com.impecsoft.SmartTrends E/SystemAlarmDispatcher: Unexpected error in onHandleIntent
java.lang.NullPointerException
at androidx.work.impl.background.systemalarm.DelayMetCommandHandler.handleProcessWork(DelayMetCommandHandler.java:149)
at androidx.work.impl.background.systemalarm.CommandHandler.handleDelayMet(CommandHandler.java:241)
at androidx.work.impl.background.systemalarm.CommandHandler.onHandleIntent(CommandHandler.java:178)
at androidx.work.impl.background.systemalarm.SystemAlarmDispatcher$1.run(SystemAlarmDispatcher.java:259)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
and again open my app:
09-26 10:50:22.698 18119-18119/com.impecsoft.SmartTrends W/dalvikvm: Unable to resolve superclass of Landroidx/work/impl/background/systemjob/SystemJobService; (85)
Link of class 'Landroidx/work/impl/background/systemjob/SystemJobService;' failed
09-26 10:50:22.698 18119-18119/com.impecsoft.SmartTrends E/dalvikvm: Could not find class 'androidx.work.impl.background.systemjob.SystemJobService', referenced from method androidx.work.impl.Schedulers.createBestAvailableBackgroundScheduler
09-26 10:50:22.698 18119-18119/com.impecsoft.SmartTrends W/dalvikvm: VFY: unable to resolve const-class 3074 (Landroidx/work/impl/background/systemjob/SystemJobService;) in Landroidx/work/impl/Schedulers;
09-26 10:50:22.698 18119-18119/com.impecsoft.SmartTrends D/dalvikvm: VFY: replacing opcode 0x1c at 0x000e
09-26 10:50:22.698 18119-18119/com.impecsoft.SmartTrends V/ApplicationPackageManager: setComponentEnabledSetting() componentName=ComponentInfo{com.impecsoft.SmartTrends/androidx.work.impl.background.systemalarm.SystemAlarmService}, newState= 1
09-26 10:50:22.708 18119-18119/com.impecsoft.SmartTrends W/dalvikvm: Unable to resolve superclass of Landroidx/work/impl/constraints/trackers/NetworkStateTracker$NetworkStateCallback; (484)
Link of class 'Landroidx/work/impl/constraints/trackers/NetworkStateTracker$NetworkStateCallback;' failed
09-26 10:50:22.708 18119-18119/com.impecsoft.SmartTrends E/dalvikvm: Could not find class 'androidx.work.impl.constraints.trackers.NetworkStateTracker$NetworkStateCallback', referenced from method androidx.work.impl.constraints.trackers.NetworkStateTracker.<init>
09-26 10:50:22.708 18119-18119/com.impecsoft.SmartTrends W/dalvikvm: VFY: unable to resolve new-instance 3097 (Landroidx/work/impl/constraints/trackers/NetworkStateTracker$NetworkStateCallback;) in Landroidx/work/impl/constraints/trackers/NetworkStateTracker;
09-26 10:50:22.708 18119-18119/com.impecsoft.SmartTrends D/dalvikvm: VFY: replacing opcode 0x22 at 0x0015
09-26 10:50:22.708 18119-18119/com.impecsoft.SmartTrends I/dalvikvm: Could not find method android.net.ConnectivityManager.getActiveNetwork, referenced from method androidx.work.impl.constraints.trackers.NetworkStateTracker.isActiveNetworkValidated
09-26 10:50:22.708 18119-18119/com.impecsoft.SmartTrends W/dalvikvm: VFY: unable to resolve virtual method 2474: Landroid/net/ConnectivityManager;.getActiveNetwork ()Landroid/net/Network;
09-26 10:50:22.708 18119-18119/com.impecsoft.SmartTrends D/dalvikvm: VFY: replacing opcode 0x6e at 0x000a
09-26 10:50:22.708 18119-18119/com.impecsoft.SmartTrends W/dalvikvm: Unable to resolve superclass of Landroidx/work/impl/constraints/trackers/NetworkStateTracker$NetworkStateCallback; (484)
Link of class 'Landroidx/work/impl/constraints/trackers/NetworkStateTracker$NetworkStateCallback;' failed
09-26 10:50:22.718 18119-18119/com.impecsoft.SmartTrends I/dalvikvm: Could not find method android.net.ConnectivityManager.registerDefaultNetworkCallback, referenced from method androidx.work.impl.constraints.trackers.NetworkStateTracker.startTracking
09-26 10:50:22.718 18119-18119/com.impecsoft.SmartTrends W/dalvikvm: VFY: unable to resolve virtual method 2481: Landroid/net/ConnectivityManager;.registerDefaultNetworkCallback (Landroid/net/ConnectivityManager$NetworkCallback;)V
09-26 10:50:22.718 18119-18119/com.impecsoft.SmartTrends D/dalvikvm: VFY: replacing opcode 0x6e at 0x0014
09-26 10:50:22.718 18119-18119/com.impecsoft.SmartTrends W/dalvikvm: Unable to resolve superclass of Landroidx/work/impl/constraints/trackers/NetworkStateTracker$NetworkStateCallback; (484)
Link of class 'Landroidx/work/impl/constraints/trackers/NetworkStateTracker$NetworkStateCallback;' failed
09-26 10:50:22.718 18119-18119/com.impecsoft.SmartTrends I/dalvikvm: Could not find method android.net.ConnectivityManager.unregisterNetworkCallback, referenced from method androidx.work.impl.constraints.trackers.NetworkStateTracker.stopTracking
09-26 10:50:22.718 18119-18119/com.impecsoft.SmartTrends W/dalvikvm: VFY: unable to resolve virtual method 2482: Landroid/net/ConnectivityManager;.unregisterNetworkCallback (Landroid/net/ConnectivityManager$NetworkCallback;)V
09-26 10:50:22.718 18119-18119/com.impecsoft.SmartTrends D/dalvikvm: VFY: replacing opcode 0x6e at 0x0014
09-26 10:50:22.718 18119-18119/com.impecsoft.SmartTrends W/dalvikvm: Unable to resolve superclass of Landroidx/work/impl/constraints/trackers/NetworkStateTracker$NetworkStateCallback; (484)
Link of class 'Landroidx/work/impl/constraints/trackers/NetworkStateTracker$NetworkStateCallback;' failed
09-26 10:50:22.718 18119-18119/com.impecsoft.SmartTrends D/dalvikvm: DexOpt: unable to opt direct call 0x5fe4 at 0x17 in Landroidx/work/impl/constraints/trackers/NetworkStateTracker;.<init>
09-26 10:50:22.728 18119-18119/com.impecsoft.SmartTrends I/dalvikvm: Could not find method android.content.Context.createDeviceProtectedStorageContext, referenced from method android.support.v4.content.ContextCompat.createDeviceProtectedStorageContext
If this is a bug in the library, we would appreciate if you could attach:
- Sample project to trigger the issue.
- A screenrecord or screenshots showing the issue (if UI related).