Status Update
Comments
ap...@google.com <ap...@google.com> #2
Oh I forgot to mention that I thought it might be connected to this issue:
ap...@google.com <ap...@google.com> #3
Please provide a minimal sample project along with the minimal steps to recreate the issue in the project.
ap...@google.com <ap...@google.com> #4
Sorry for the delay. I got a working example here:
I poked into it a little bit and it seems to be connected to
Steps to reproduce:
- Navigate from Second Fragment to Child nav graph (with non-nullable parameters).
- Navigate to Third fragment using SafeArgs and the app crashes.
Crash log:
Process: cz.dels.issues, PID: 1743
java.lang.NullPointerException: null cannot be cast to non-null type kotlin.Long
at androidx.navigation.NavType$Companion$LongType$1.get(NavType.kt:352)
at androidx.navigation.NavType$Companion$LongType$1.get(NavType.kt:342)
at androidx.navigation.NavArgument.verify(NavArgument.kt:76)
at androidx.navigation.NavDestination.addInDefaultArgs(NavDestination.kt:502)
at androidx.navigation.NavController.addEntryToBackStack(NavController.kt:1865)
at androidx.navigation.NavController.addEntryToBackStack$default(NavController.kt:1813)
at androidx.navigation.NavController$navigate$4.invoke(NavController.kt:1721)
at androidx.navigation.NavController$navigate$4.invoke(NavController.kt:1719)
at androidx.navigation.NavController$NavControllerNavigatorState.push(NavController.kt:287)
at androidx.navigation.fragment.FragmentNavigator.navigate(FragmentNavigator.kt:246)
at androidx.navigation.fragment.FragmentNavigator.navigate(FragmentNavigator.kt:162)
at androidx.navigation.NavController.navigateInternal(NavController.kt:260)
at androidx.navigation.NavController.navigate(NavController.kt:1719)
at androidx.navigation.NavController.navigate(NavController.kt:1545)
at androidx.navigation.NavController.navigate(NavController.kt:1472)
at androidx.navigation.NavController.navigate(NavController.kt:1930)
at cz.dels.issues.SecondFragment.onViewCreated$lambda-0(SecondFragment.kt:38)
at cz.dels.issues.SecondFragment.$r8$lambda$XDYnOS_cYrafiNQ5rcCu1WCn0IE(Unknown Source:0)
at cz.dels.issues.SecondFragment$$ExternalSyntheticLambda0.onClick(Unknown Source:2)
Note: If in step 2 SaveArgs is not used then navigation works correctly. More information is here:
ap...@google.com <ap...@google.com> #5
Ups a typo: Navigate from Second First Fragment to Child nav graph (with non-nullable parameters).
Note: sorry for the spam but I am not able to edit my own comment.
ap...@google.com <ap...@google.com> #6
This has been fixed and will be available in navigation 2.6.0-alpha08
ap...@google.com <ap...@google.com> #7
Branch: androidx-main
commit 6b358154b794a0456b089ac8e548bfb830dd6c22
Author: Clara Fok <clarafok@google.com>
Date: Tue Mar 14 17:56:12 2023
Fix missing non-nullable arg when rebuilding hierarchy
When navigating with NavDirections, args is populated with an empty bundle. This causes issue when we rebuild parent hierarchy while adding a new entry to NavBackStack. If the Entry being rebuilt contains a non-nullalbe arg, i.e. Long, this empty bundle will cause an exception.
Test: ./gradlew navigation:navigation-runtime:cC
Bug: 249988437
Change-Id: I5c8ce739ad9a3428c8a8de13eae391bfff0db5df
M navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerTest.kt
M navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
ap...@google.com <ap...@google.com> #8
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.navigation:navigation-runtime:2.6.0-alpha08
ap...@google.com <ap...@google.com> #9
Branch: androidx-main
commit 7220fdfc37ee734820cda773812ad7ec40e587d6
Author: Jeremy Woods <jbwoods@google.com>
Date: Thu Apr 01 14:42:02 2021
Add popUpToRoute to NavOptions
Instead of popUpTo with an id, you can now use it with route.
RelNote: "NavOptions now supports popUpToRoute to allow popping to the
given destination route"
Test: NavOptionsBuilderTest
Bug: 172823546
Change-Id: I0c8fb723e1bfb410b1518a619620415f7a1893e1
M navigation/navigation-common/api/api_lint.ignore
M navigation/navigation-common/api/current.txt
M navigation/navigation-common/api/public_plus_experimental_current.txt
M navigation/navigation-common/api/restricted_current.txt
M navigation/navigation-common/src/androidTest/java/androidx/navigation/NavOptionsBuilderTest.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavOptions.kt
M navigation/navigation-common/src/main/java/androidx/navigation/NavOptionsBuilder.kt
ap...@google.com <ap...@google.com> #10
Branch: androidx-main
commit 385530a581a2438d09c6aa8a96635927c1bdb08a
Author: Jeremy Woods <jbwoods@google.com>
Date: Wed Apr 07 15:02:34 2021
Remove routes from navigation compose
Routes are now part of base navigation so we can remove them from
nav-compose. Removed the duplicated APIs and made the appropriate
changes to imports.
RelNote: "You no longer need to use extension methods for route support
in Navigation Compose."
Test: ./gradlew checkApi
Bug: 172823546
Change-Id: I22beb923cccecdc76c555abc7921ab3d9efc860d
M compose/integration-tests/docs-snippets/src/main/java/androidx/compose/integration/docs/libraries/Libraries.kt
M compose/integration-tests/docs-snippets/src/main/java/androidx/compose/integration/docs/navigation/Navigation.kt
M compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/NavGraph.kt
M hilt/hilt-navigation-compose/samples/src/main/java/androidx/hilt/navigation/compose/samples/HiltViewModelSamples.kt
M hilt/hilt-navigation-compose/src/androidTest/java/androidx/hilt/navigation/compose/HiltViewModelComposeTest.kt
M hilt/hilt-navigation-compose/src/main/java/androidx/hilt/navigation/compose/HiltViewModel.kt
M navigation/navigation-compose/api/current.txt
M navigation/navigation-compose/api/public_plus_experimental_current.txt
M navigation/navigation-compose/api/restricted_current.txt
M navigation/navigation-compose/integration-tests/navigation-demos/src/main/java/androidx/navigation/compose/demos/BottomBarNavDemo.kt
M navigation/navigation-compose/integration-tests/navigation-demos/src/main/java/androidx/navigation/compose/demos/NavPopUpToDemo.kt
M navigation/navigation-compose/integration-tests/navigation-demos/src/main/java/androidx/navigation/compose/demos/NavSingleTopDemo.kt
M navigation/navigation-compose/integration-tests/navigation-demos/src/main/java/androidx/navigation/compose/demos/NavWithArgsDemo.kt
M navigation/navigation-compose/samples/src/main/java/androidx/navigation/compose/samples/NavigationSamples.kt
M navigation/navigation-compose/src/androidTest/java/androidx/navigation/compose/NavGraphBuilderTest.kt
M navigation/navigation-compose/src/androidTest/java/androidx/navigation/compose/NavHostControllerTest.kt
M navigation/navigation-compose/src/androidTest/java/androidx/navigation/compose/NavHostTest.kt
M navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavGraphBuilder.kt
M navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavHost.kt
M navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavHostController.kt
D navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavOptionsBuilder.kt
il...@google.com <il...@google.com> #11
We've completed the merge of Navigation Compose specific concepts like routes into the core classes of Navigation (i.e., NavDestination
, NavController
, etc.). As such, many of the APIs that used to be extension methods are now methods on the classes themselves. This means that a number of imports previously needed can be removed:
import androidx.navigation.compose.navigation
import androidx.navigation.compose.createGraph
import androidx.navigation.compose.getBackStackEntry
import androidx.navigation.compose.navigate
import androidx.navigation.compose.popUpTo
And the KEY_ROUTE
can now be accessed simply by calling destination.route
.
With these changes, Navigation Compose will join the same versioning scheme as the rest of Navigation and be moved to version 2.4.0-alpha01
for the next version.
Description
Navigation Compose has APIs that would be a better fit as part of the base Navigation library. Instead of allowing Navigation Compose to go to 1.0.0 stable with the libraries and attempting to deprecate them later when they are added to base Navigation, we should instead add those APIs to the next version of Navigation and move Navigation Compose in sync with that.
This means that Navigation Compose will be part of Navigation 2.4.0 instead of an 1.0.0.