Repository navigation
Crashes when navigating fast between tabs #6199
Copy link
Copy link
Closed
Description
Please consider this sample:
https://play.nativescript.org/?template=play-js&id=3gxfjn&v=2
If you navigate between tabs fast enough you run into this problem:
An uncaught Exception occurred on "main" thread.
android.content.res.Resources$NotFoundException: Resource ID #0xffffffec
at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:215)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2134)
at android.content.res.Resources.getAnimation(Resources.java:1167)
at android.animation.AnimatorInflater.loadAnimator(AnimatorInflater.java:125)
at android.animation.AnimatorInflater.loadAnimator(AnimatorInflater.java:106)
at android.animation.AnimatorInflater.loadAnimator(AnimatorInflater.java:91)
at android.app.FragmentManagerImpl.loadAnimator(FragmentManager.java:1089)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1368)
at android.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1557)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1630)
at android.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2196)
at android.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2142)
at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2043)
at android.app.FragmentManagerImpl$1.run(FragmentManager.java:719)
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:6753)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:482)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
And consider this one: https://play.nativescript.org/?template=play-js&id=3gxfjn&v=3
If you navigate fast between tabs, then you run into this crash:
An uncaught Exception occurred on "main" thread.
java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
at android.view.ViewGroup.addViewInner(ViewGroup.java:4941)
at android.view.ViewGroup.addView(ViewGroup.java:4772)
at android.view.ViewGroup.addView(ViewGroup.java:4712)
at android.view.ViewGroup.addView(ViewGroup.java:4685)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1284)
at android.app.FragmentManagerImpl.addAddedFragments(FragmentManager.java:2407)
at android.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2186)
at android.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2142)
at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2043)
at android.app.FragmentManagerImpl$1.run(FragmentManager.java:719)
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:6753)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:482)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Reactions are currently unavailable
Activity
vahidvdn commentedon Aug 20, 2018
@shiv19 That's because it uses routing in the tab component. See this issue for more details.
shiv19 commentedon Aug 20, 2018
@vahidvdn
I'm not using a
TabViewhere, this is a different issue :)tsonevn commentedon Aug 21, 2018
HI @shiv19,
Thank you for the attached sample projects.
I was able to recreate the issue on my side and will mark this as a bug.
Regarding your case, I would suggest using the TabView provided by tns-core-modules instead of creating a custom one.
shiv19 commentedon Aug 21, 2018
@tsonevn
The main goal of this custom implementation
Was to make that animation of the "tab highlight"
When you jump from tab 1 to say tab 4,
You can see the "tab highlight" travel across tabs 2 and 3 and stop at tab 4.
DickSmith commentedon Sep 8, 2018
I've been experiencing this issue randomly for a number of months on Firebase/Crashlytics (partial data for the last 3 weeks):
The line number and
Resources/ResourcesImplprobably comes down to exactly which version of Android is being run, but the commonality is that it is always that it's an animation on aFragmentManagerand theResource ID#0xffffffec.With some help from @NathanaelA , we realized that this number is
-20and after searching the code base I found this:https://github.com/NativeScript/NativeScript/blob/master/tns-core-modules/ui/frame/fragment.transitions.d.ts#L13
It appears there is a possible chance of a race condition on the animations resulting in the
fakeresource being used.Searching for
Nativescript #0xffffffecI find these related tickets:#1569 (2016)
#5549 -> NativeScript/android#974 -> #5657
NathanaelA commentedon Sep 8, 2018
NathanaelA commentedon Sep 8, 2018
lock commentedon Sep 18, 2019
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.