Status Update
Comments
gu...@gmail.com <gu...@gmail.com> #2
Can you include a sample project that reproduces your issue?
Note that if you want to just return to your main graph (which I assume launched your login_nav_graph
), you would want to leave out the app:destination="@id/main_nav_graph"
line entirely as that will create a second instance of your main_nav_graph
.
il...@google.com <il...@google.com> #3
Thank you! While working on a minimal repro and keeping your comment in mind, I solved my problem.
My problem was partly that I had an app:destination
in my pop action, but also that the action leading to login_nav_graph
was popping:
<action
android:id="@+id/logout"
app:destination="@id/login_nav_graph"
app:popUpTo="@id/main_nav_graph"
app:popUpToInclusive="true" />
Here is a working sample of what I wanted to achieve:
main_nav_graph.xml
<?xml version="1.0" encoding="utf-8"?>
<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"
android:id="@+id/main_nav_graph"
app:startDestination="@id/mainFragment">
<fragment
android:id="@+id/mainFragment"
android:name="app.reitan.navigationrepro.MainFragment"
android:label="fragment_main"
tools:layout="@layout/fragment_main">
<action
android:id="@+id/to_login_nav_graph"
app:destination="@id/login_nav_graph"/>
</fragment>
<include app:graph="@navigation/login_nav_graph" />
</navigation>
login_nav_graph.xml
<?xml version="1.0" encoding="utf-8"?>
<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"
android:id="@+id/login_nav_graph"
app:startDestination="@id/loginFragment">
<fragment
android:id="@+id/loginFragment"
android:name="app.reitan.navigationrepro.LoginFragment"
android:label="fragment_login"
tools:layout="@layout/fragment_login">
<action
android:id="@+id/pop_login_nav_graph"
app:popUpTo="@id/main_nav_graph"
app:popUpToInclusive="true" />
</fragment>
</navigation>
gu...@gmail.com <gu...@gmail.com> #4
Even though the error was probably in my code, this is still a change of behavior, as this used to work fine in 2.3.0. Just so you know :)
Description
Version used: 1.0.0-alpha01
Devices/Android versions reproduced on: One Plus X (Android 6.0.1) / Galaxy Tab S2 (Android 7.0)
I'm building a PendingIntent from a widget (and also from a notification) to deep link into my app like this:
val pendingIntent = NavDeepLinkBuilder(context).setGraph(R.navigation.nav_graph).setArguments(bundleOf(("A" to "B"))).setDestination(R.id.all_quotes_fragment).createPendingIntent()
When I click on my widget/notification it opens the app as expected. But as soon as the onSaveInstanceState is triggered my app is crashing (see enclosed logcat stacktraces).
I tried to make a new project to reproduce the issue but I can't reproduce it.
Note 1: If I remove the argument from the PendingIntent like below then I'm not having the crash anymore.
val pendingIntent = NavDeepLinkBuilder(context).setGraph(R.navigation.nav_graph).setDestination(R.id.all_quotes_fragment).createPendingIntent()
Note 2: I'm using the Facebook SDK in my app (com.facebook.android:facebook-android-sdk:4.33.0) and if I remove it then my app isn't crashing anymore even if i'm passing arguments to my PendingIntent.
It's a bit strange that just passing this Bundle (bundleOf(("A" to "B"))) make the app crashing.
Looking at the stacktrace it seems that there is an infinite recursion that could be the origin of the issue.
By the way, I'm not doing any state saving by my self.
I'll keep trying to reproduce the issue otherwise it'll be hard to dig this issue.