Fixed
Status Update
Comments
il...@google.com <il...@google.com> #2
This is fixed internally and will be available in alpha02
il...@google.com <il...@google.com>
ap...@google.com <ap...@google.com> #3
I've modified the build.gradle file (of the attached "MyAppplication" project) to the latest iteration (alpha2) to test the changes. When I pass through the same flow twice (shown in attached screen recording) I get an exception (listed below). Should I initiate a new issue for it?
--------- beginning of crash
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.myapplication, PID: 3799
java.util.NoSuchElementException
at java.util.ArrayDeque.removeLast(ArrayDeque.java:274)
at androidx.navigation.fragment.FragmentNavigator.popBackStack(FragmentNavigator.java:87)
at androidx.navigation.NavController.popBackStack(NavController.java:280)
at androidx.navigation.NavController.navigate(NavController.java:642)
at androidx.navigation.NavController.navigate(NavController.java:592)
at androidx.navigation.Navigation$1.onClick(Navigation.java:118)
at android.view.View.performClick(View.java:6294)
at android.view.View$PerformClick.run(View.java:24770)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
--------- beginning of crash
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.myapplication, PID: 3799
java.util.NoSuchElementException
at java.util.ArrayDeque.removeLast(ArrayDeque.java:274)
at androidx.navigation.fragment.FragmentNavigator.popBackStack(FragmentNavigator.java:87)
at androidx.navigation.NavController.popBackStack(NavController.java:280)
at androidx.navigation.NavController.navigate(NavController.java:642)
at androidx.navigation.NavController.navigate(NavController.java:592)
at androidx.navigation.Navigation$1.onClick(Navigation.java:118)
at android.view.View.performClick(View.java:6294)
at android.view.View$PerformClick.run(View.java:24770)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
il...@google.com <il...@google.com> #4
The alternative paths shown in the attached recordings also lead to the aforementioned exception.
ru...@gmail.com <ru...@gmail.com> #5
[Deleted User] <[Deleted User]> #6
Can't wait to use this library after the move to AndroidX.
For us is a major blocking feature and we don't want to proceed overriding all the necessary classes.
Thank you Ian and the rest of the navigation team.
For us is a major blocking feature and we don't want to proceed overriding all the necessary classes.
Thank you Ian and the rest of the navigation team.
il...@google.com <il...@google.com>
il...@google.com <il...@google.com>
ap...@google.com <ap...@google.com> #7
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 74c3760e428648d00249dc1d38865b7802f48a9a
Author: Ian Lake <ilake@google.com>
Date: Wed Mar 13 13:11:57 2019
Use FragmentFactory in FragmentNavigator
Rely on the FragmentManager's FragmentFactory
to instantiate Fragments created for
FragmentNavigator.
Test: new FragmentNavigatorTest
Fixes: 119054429
Change-Id: Icbeb2771e29cafdc52e4c4ea770ce89f739921d1
M navigation/fragment/src/androidTest/java/androidx/navigation/fragment/FragmentNavigatorTest.kt
M navigation/fragment/src/main/java/androidx/navigation/fragment/FragmentNavigator.java
https://android-review.googlesource.com/928481
https://goto.google.com/android-sha1/74c3760e428648d00249dc1d38865b7802f48a9a
Branch: androidx-master-dev
commit 74c3760e428648d00249dc1d38865b7802f48a9a
Author: Ian Lake <ilake@google.com>
Date: Wed Mar 13 13:11:57 2019
Use FragmentFactory in FragmentNavigator
Rely on the FragmentManager's FragmentFactory
to instantiate Fragments created for
FragmentNavigator.
Test: new FragmentNavigatorTest
Fixes: 119054429
Change-Id: Icbeb2771e29cafdc52e4c4ea770ce89f739921d1
M navigation/fragment/src/androidTest/java/androidx/navigation/fragment/FragmentNavigatorTest.kt
M navigation/fragment/src/main/java/androidx/navigation/fragment/FragmentNavigator.java
il...@google.com <il...@google.com> #8
This is fixed internally - FragmentNavigator will use the FragmentFactory to create Fragments in the upcoming 2.1.0-alpha01 release.
[Deleted User] <[Deleted User]> #9
Thank you Ian :)
ap...@google.com <ap...@google.com> #10
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 3dd6d1fcdb3ffa7d4bd265a023f0ac7c94e14d19
Author: Ian Lake <ilake@google.com>
Date: Mon Mar 18 09:36:37 2019
Deprecate FragmentNavigator.instantiateFragment
Instead of providing a custom subclass of
FragmentNavigator, instantiation of Fragments
should be controlled by setting a custom
FragmentFactory, which is the default behavior
of instantiateFragment() now.
By deprecating the class, we ensure that
developers who were overriding this method
are informed of the changes and can change
their code to use FragmentFactory.
Test: ./gradlew checkApi
BUG: 119054429
Change-Id: Iff46919face98baa6dc62835ca3fc105d987d141
M navigation/fragment/api/2.1.0-alpha01.txt
M navigation/fragment/api/current.txt
M navigation/fragment/src/main/java/androidx/navigation/fragment/FragmentNavigator.java
https://android-review.googlesource.com/930120
https://goto.google.com/android-sha1/3dd6d1fcdb3ffa7d4bd265a023f0ac7c94e14d19
Branch: androidx-master-dev
commit 3dd6d1fcdb3ffa7d4bd265a023f0ac7c94e14d19
Author: Ian Lake <ilake@google.com>
Date: Mon Mar 18 09:36:37 2019
Deprecate FragmentNavigator.instantiateFragment
Instead of providing a custom subclass of
FragmentNavigator, instantiation of Fragments
should be controlled by setting a custom
FragmentFactory, which is the default behavior
of instantiateFragment() now.
By deprecating the class, we ensure that
developers who were overriding this method
are informed of the changes and can change
their code to use FragmentFactory.
Test: ./gradlew checkApi
BUG: 119054429
Change-Id: Iff46919face98baa6dc62835ca3fc105d987d141
M navigation/fragment/api/2.1.0-alpha01.txt
M navigation/fragment/api/current.txt
M navigation/fragment/src/main/java/androidx/navigation/fragment/FragmentNavigator.java
Description
Version used: Fragment 1.1.0-alpha01, Nav 1.0.0-alpha07
Devices/Android versions reproduced on: All
When using FragmentFactory attached to a fragment manager, FragmentNavigator$Destination.createFragment() throws an "InstantiationException: <Fragment> has no zero argument constructor". It appears that upon creating the nav graph, NavHotsFragment instantiates fragments itself instead of delegating to the fragment manager.