Status Update
Comments
ar...@google.com <ar...@google.com> #2
Can you please provide the below requested information to better understand the issue:
Steps to reproduce
Please provide source code or apk of a sample application to reproduce the issue.
Also kindly mention the steps to be followed for reproducing the issue with the given sample application.
Frequency
How frequently does this issue occur? (e.g 100% of the time, 10% of the time)
Expected output
Could you please explain the expected behavior.
Current output
Could you please explain the current behavior.
Steps to reproduce
Please provide source code or apk of a sample application to reproduce the issue.
Also kindly mention the steps to be followed for reproducing the issue with the given sample application.
Frequency
How frequently does this issue occur? (e.g 100% of the time, 10% of the time)
Expected output
Could you please explain the expected behavior.
Current output
Could you please explain the current behavior.
[Deleted User] <[Deleted User]> #3
Steps to reproduce
1. Open Dialog Fragment Like below code with setting Target Fragment.
LinkInsertDialogFragment linkInsertDialogFragment = LinkInsertDialogFragment.newInstance();
linkInsertDialogFragment.setTargetFragment(EditNoteFragment.this,1245);
linkInsertDialogFragment.show(getChildFragmentManager());
2. Execute this code.
Frequency
100%
Expected output
The exception mentioned in above reply should not happen in support library 26.0.0 and 26.0.1 as it does not happen the previous version of support library 25.4.0.
Current output
it throws an exception and application crash.
java.lang.IllegalStateException: Fragment LinkInsertDialogFragment{2755fa2c #0 com.test.test.fragments.LinkInsertDialogFragment} declared target fragment EditNoteFragment{1dd10ccd #4 id=0x7f0f00b7 com.test.test.fragments.note.EditNoteFragment} that does not belong to this FragmentManager!
Thanks.
1. Open Dialog Fragment Like below code with setting Target Fragment.
LinkInsertDialogFragment linkInsertDialogFragment = LinkInsertDialogFragment.newInstance();
linkInsertDialogFragment.setTargetFragment(EditNoteFragment.this,1245);
linkInsertDialogFragment.show(getChildFragmentManager());
2. Execute this code.
Frequency
100%
Expected output
The exception mentioned in above reply should not happen in support library 26.0.0 and 26.0.1 as it does not happen the previous version of support library 25.4.0.
Current output
it throws an exception and application crash.
java.lang.IllegalStateException: Fragment LinkInsertDialogFragment{2755fa2c #0 com.test.test.fragments.LinkInsertDialogFragment} declared target fragment EditNoteFragment{1dd10ccd #4 id=0x7f0f00b7 com.test.test.fragments.note.EditNoteFragment} that does not belong to this FragmentManager!
Thanks.
ar...@google.com <ar...@google.com> #4
We are not able to reproduce the issue with the sample code given in comment #3 .
Please provide an sample project or apk as requested in comment #2 .
Please provide an sample project or apk as requested in
[Deleted User] <[Deleted User]> #6
Here is sample project which reproduces it.
1. Click the button within fragment which opens a dialog fragment
2. It will crash for Support Library 26.0.1 and same code working fine in 25.4.0
1. Click the button within fragment which opens a dialog fragment
2. It will crash for Support Library 26.0.1 and same code working fine in 25.4.0
wx...@gmail.com <wx...@gmail.com> #7
Hi,
I have encountered exactly the same issue here, using getFragmentManager() instead of getChildFragmentManager() can in some case be a workaround. Hope this can be fixed quick.
Thanks.
I have encountered exactly the same issue here, using getFragmentManager() instead of getChildFragmentManager() can in some case be a workaround. Hope this can be fixed quick.
Thanks.
ar...@google.com <ar...@google.com> #8
We have passed this defect on to the engineering team and will update this issue with more information as it becomes available.
yt...@gmail.com <yt...@gmail.com> #9
This was marked as "working as intended" on https://issuetracker.google.com/issues/62974813 , right?
Solution is very straightforward, use same fragment manager, getFragmentManager instead of getChildFragmentManager in simple case.
But I think this is very important as P2 or above! All devs should check their code.
Solution is very straightforward, use same fragment manager, getFragmentManager instead of getChildFragmentManager in simple case.
But I think this is very important as P2 or above! All devs should check their code.
[Deleted User] <[Deleted User]> #10
We're also running into this crash now. This appears to be a change with Support Library version 26.0.0. Can this be added to the Support Library Release Notes Page for that version? https://developer.android.com/topic/libraries/support-library/revisions.html
I agree with the previous comment - this needs visibility. Developers need to know to re-test this code. And if developers start running into this crash, it's currently not easy to track down what change specifically would have introduced the crash.
The correct solution can also be difficult to work out, but I don't think there can be a canonical answer aside from "make sure you understand which fragment manager you're using for everything and then do the right thing for your case." :)
I agree with the previous comment - this needs visibility. Developers need to know to re-test this code. And if developers start running into this crash, it's currently not easy to track down what change specifically would have introduced the crash.
The correct solution can also be difficult to work out, but I don't think there can be a canonical answer aside from "make sure you understand which fragment manager you're using for everything and then do the right thing for your case." :)
ja...@gmail.com <ja...@gmail.com> #11
I too confirm this problem with API >=26 or with android support libs >= 26
mi...@gmail.com <mi...@gmail.com> #12
This bug totally blocks upgrading.
The only way to upgrade is to throw away these buggy fragments and use Conductor, Flow, etc.
The only way to upgrade is to throw away these buggy fragments and use Conductor, Flow, etc.
is...@google.com <is...@google.com>
il...@google.com <il...@google.com> #13
This is indeed the same issue as https://issuetracker.google.com/issues/62974813 - the target Fragment must be from the same FragmentManager as the Fragment is added, so you must use getFragmentManager() and not getChildFragmentManager() if you want to use setTargetFragment().
Alternatively, use getChildFragmentManager() and getParentFragment().
Alternatively, use getChildFragmentManager() and getParentFragment().
Description
LinkInsertDialogFragment linkInsertDialogFragment = LinkInsertDialogFragment.newInstance();
linkInsertDialogFragment.setTargetFragment(EditNoteFragment.this,LinkInsertDialogFragment.LINK_INSERT_CODE);
linkInsertDialogFragment.show(getChildFragmentManager());
Crash does not happen when I down grade to Support Library 25.4.0
java.lang.IllegalStateException: Fragment LinkInsertDialogFragment{2755fa2c #0 com.test.test.fragments.LinkInsertDialogFragment} declared target fragment EditNoteFragment{1dd10ccd #4 id=0x7f0f00b7 com.test.test.fragments.note.EditNoteFragment} that does not belong to this FragmentManager!
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1352)
at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1740)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1809)
at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:799)
at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2580)
at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2367)
at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2322)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2229)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:700)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5343)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)