Fixed
Status Update
Comments
lc...@gmail.com <lc...@gmail.com> #2
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 42d5037be3a80f5ff840eee1f0a74bfb8f287d66
Author: Ben Weiss <benweiss@google.com>
Date: Thu Dec 10 16:20:02 2020
Add factory functions for DynamicNavHostFragment
Bug: 175222619
Test: updateApi and cAT
RelNote: Add factory functions for DynamicNavHostFragment
Change-Id: Icd51523a8f3cc3f93fffc1796c6a270bc28eaede
M navigation/navigation-dynamic-features-fragment/api/current.txt
M navigation/navigation-dynamic-features-fragment/api/public_plus_experimental_current.txt
M navigation/navigation-dynamic-features-fragment/api/restricted_current.txt
M navigation/navigation-dynamic-features-fragment/src/androidTest/java/androidx/navigation/dynamicfeatures/fragment/DynamicFragmentNavigatorDestinationBuilderTest.kt
M navigation/navigation-dynamic-features-fragment/src/androidTest/java/androidx/navigation/dynamicfeatures/fragment/DynamicNavHostFragmentTest.kt
M navigation/navigation-dynamic-features-fragment/src/main/java/androidx/navigation/dynamicfeatures/fragment/DynamicNavHostFragment.kt
M navigation/navigation-fragment/src/main/java/androidx/navigation/fragment/NavHostFragment.java
https://android-review.googlesource.com/1523818
Branch: androidx-master-dev
commit 42d5037be3a80f5ff840eee1f0a74bfb8f287d66
Author: Ben Weiss <benweiss@google.com>
Date: Thu Dec 10 16:20:02 2020
Add factory functions for DynamicNavHostFragment
Bug: 175222619
Test: updateApi and cAT
RelNote: Add factory functions for DynamicNavHostFragment
Change-Id: Icd51523a8f3cc3f93fffc1796c6a270bc28eaede
M navigation/navigation-dynamic-features-fragment/api/current.txt
M navigation/navigation-dynamic-features-fragment/api/public_plus_experimental_current.txt
M navigation/navigation-dynamic-features-fragment/api/restricted_current.txt
M navigation/navigation-dynamic-features-fragment/src/androidTest/java/androidx/navigation/dynamicfeatures/fragment/DynamicFragmentNavigatorDestinationBuilderTest.kt
M navigation/navigation-dynamic-features-fragment/src/androidTest/java/androidx/navigation/dynamicfeatures/fragment/DynamicNavHostFragmentTest.kt
M navigation/navigation-dynamic-features-fragment/src/main/java/androidx/navigation/dynamicfeatures/fragment/DynamicNavHostFragment.kt
M navigation/navigation-fragment/src/main/java/androidx/navigation/fragment/NavHostFragment.java
jo...@gmail.com <jo...@gmail.com> #3
I couldn't seem to find the create method in my codebase on the latest Navigation release 2.3.5. Has this change been merged into latest release?
il...@google.com <il...@google.com>
ap...@google.com <ap...@google.com> #4
This adds new APIs therefore will be available in Navigation 2.4.0-alpha01.
jb...@google.com <jb...@google.com> #5
This has been fixed internally and will be available in the Navigation 2.4.0-alpha10
release.
ec...@gmail.com <ec...@gmail.com> #6
I'm still seeing this issue on version 2.5.2
jb...@google.com <jb...@google.com> #7
Please file a new issue with a minimal project reproducing what you are seeing.
Description
Component used: Navigation
Version used: 2.4.0-alpha09
Devices/Android versions reproduced on: Not device dependent, code generation issue
Safeargs plugin on 2.4.0-alpha09 since it implemented this behaviour change below
When generating arguments, Safe Args now puts parameters without default values before those with default values. (I89709, b/198493585)
This bahvious change seesms to cause the side effect of compilation time errors in the genrated argument files. As far as I know this affects both kotlin and java generated files.
e.g.
XML navgraph destination (
NavCompFingerPrintAuthDialogFragment
)As you can see the arguments with no default values are not defined first.
this will generate the argument data object shown below with the behavios change which puts the arguments with no default values first in the constructor.
Now the problem is that in the
NavCompFingerPrintAuthDialogFragmentArgs.fromBundle(bundle: Bundle): NavCompFingerPrintAuthDialogFragmentArgs
companion function does not use named arguments when creating aNavCompFingerPrintAuthDialogFragmentArgs
from a bundle. And it uses the arguments in the order that it was defined in the navgraph and not in the order that theNavCompFingerPrintAuthDialogFragmentArgs
data object expects in its constructor. The same issue also apples for the companion functionfromSavedStateHandle(savedStateHandle: SavedStateHandle):NavCompFingerPrintAuthDialogFragmentArgs
but compilation will fail at the earliest point so it was not reported in the error. But from what i can see in the genrated code, its will have the same problem too.One solution is to just use named arguments for kotlin generated files, but it does not solve the issue for java generated files. So perhaps putting the arguments in the order of the
behavior change
mention above shld solve the issue.