[BottomNavigation][Android] - ANR issue with some dependencies in "ui-material-bottom-navigation"
Hi all,
I'm encountering a critical issue with the @nativescript-community/ui-material-bottom-navigation package in a production Android application. I’m observing frequent and repeated Application Not Responding (ANR) events traced back to native view layout processing.
ANR Trace as Appears in GoogleConsole:
[split_config.arm64_v8a.apk] v8::internal::FunctionCallbackArguments::Call
Some notable native stack trace highlights:
at android.view.ViewRootImpl.performLayout (ViewRootImpl.java:4005)
at androidx.viewpager2.widget.ViewPager2.onLayout (ViewPager2.java:527)
While the ANR is initially triggered in the layout pass (ViewRootImpl.performLayout), it appears the root cause is linked to ViewPager2, which is likely used internally by one of the dependencies of the bottom navigation component—not the bottom navigation library directly.
The only part that ViewPager2 is being used is in some of this dependencies
"dependencies": {
"@nativescript-community/ui-material-core": "^7.2.71",
"@nativescript-community/ui-material-core-tabs": "^7.2.71"
}
Additional Notes:
- The issue seems to happen on Android 12 (API 31) and above.
- The package appears to be maintained by @farfromrefug , but I haven't found any open issues addressing this specific behavior.
I’d appreciate any insights from maintainers or others who might have encountered similar behavior—particularly regarding ViewPager2 interactions within NativeScript contexts.
I can provide more info or logs if you need
Thanks in advance for any assistance or guidance. 👐
@PsHye you need to share the full callstack.
Now that being said just like that i have no idea what the issue could be (i dont use that plugin, created it for community need). If you want us to help you you need to create a simple project reproducing the issue so that we can reproduce locally. I know it might not be easy but this is the only way
@PsHye you need to share the full callstack.
Now that being said just like that i have no idea what the issue could be (i dont use that plugin, created it for community need). If you want us to help you you need to create a simple project reproducing the issue so that we can reproduce locally. I know it might not be easy but this is the only way
@PsHye you need to share the full callstack.
Now that being said just like that i have no idea what the issue could be (i dont use that plugin, created it for community need). If you want us to help you you need to create a simple project reproducing the issue so that we can reproduce locally. I know it might not be easy but this is the only way
Yeah sure, I can share the ANR stack trace I have marked the point where the ANR of GoogleDeveloperConsole seems to crash
at com.tns.Runtime.callJSMethodNative (Native method)
at com.tns.Runtime.dispatchCallJSMethodNative (Runtime.java:1302)
at com.tns.Runtime.callJSMethodImpl (Runtime.java:1188)
at com.tns.Runtime.callJSMethod (Runtime.java:1175)
at com.tns.Runtime.callJSMethod (Runtime.java:1153)
at com.tns.Runtime.callJSMethod (Runtime.java:1149)
at com.tns.FragmentClass.onCreateView (FragmentClass.java:55)
at androidx.fragment.app.Fragment.performCreateView (Fragment.java:3119)
at androidx.fragment.app.FragmentStateManager.createView (FragmentStateManager.java:577)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState (FragmentStateManager.java:286)
at androidx.fragment.app.FragmentManager.executeOpsTogether (FragmentManager.java:2214)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute (FragmentManager.java:2109)
at androidx.fragment.app.FragmentManager.execPendingActions (FragmentManager.java:2052)
at androidx.fragment.app.FragmentManager.dispatchStateChange (FragmentManager.java:3327)
at androidx.fragment.app.FragmentManager.dispatchViewCreated (FragmentManager.java:3230)
at androidx.fragment.app.Fragment.performViewCreated (Fragment.java:3153)
at androidx.fragment.app.FragmentStateManager.createView (FragmentStateManager.java:608)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState (FragmentStateManager.java:286)
at androidx.fragment.app.FragmentManager.executeOpsTogether (FragmentManager.java:2214)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute (FragmentManager.java:2109)
at androidx.fragment.app.FragmentManager.execSingleAction (FragmentManager.java:2002)
at androidx.fragment.app.BackStackRecord.commitNow (BackStackRecord.java:317)
at androidx.viewpager2.adapter.FragmentStateAdapter.placeFragmentInViewHolder (FragmentStateAdapter.java:341)
at androidx.viewpager2.adapter.FragmentStateAdapter.onViewAttachedToWindow (FragmentStateAdapter.java:276)
at androidx.viewpager2.adapter.FragmentStateAdapter.onViewAttachedToWindow (FragmentStateAdapter.java:67)
at androidx.recyclerview.widget.RecyclerView.dispatchChildAttached (RecyclerView.java:7556)
at androidx.recyclerview.widget.RecyclerView$5.addView (RecyclerView.java:860)
at androidx.recyclerview.widget.ChildHelper.addView (ChildHelper.java:107)
at androidx.recyclerview.widget.RecyclerView$LayoutManager.addViewInt (RecyclerView.java:8601)
at androidx.recyclerview.widget.RecyclerView$LayoutManager.addView (RecyclerView.java:8559)
at androidx.recyclerview.widget.RecyclerView$LayoutManager.addView (RecyclerView.java:8547)
at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk (LinearLayoutManager.java:1641)
at androidx.recyclerview.widget.LinearLayoutManager.fill (LinearLayoutManager.java:1587)
at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren (LinearLayoutManager.java:665)
at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2 (RecyclerView.java:4134)
at androidx.recyclerview.widget.RecyclerView.dispatchLayout (RecyclerView.java:3851)
at androidx.recyclerview.widget.RecyclerView.onLayout (RecyclerView.java:4404)
at android.view.View.layout (View.java:24969)
at android.view.ViewGroup.layout (ViewGroup.java:6784)
at androidx.viewpager2.widget.ViewPager2.onLayout (ViewPager2.java:527)
at android.view.View.layout (View.java:24969)
at android.view.ViewGroup.layout (ViewGroup.java:6784)
at org.nativescript.widgets.CommonLayoutParams.layoutChild (CommonLayoutParams.java:222)
at org.nativescript.widgets.GridLayout.onLayout (GridLayout.java:425)
at android.view.View.layout (View.java:24969)
at android.view.ViewGroup.layout (ViewGroup.java:6784)
at org.nativescript.widgets.CommonLayoutParams.layoutChild (CommonLayoutParams.java:222)
at org.nativescript.widgets.AbsoluteLayout.onLayout (AbsoluteLayout.java:83)
at android.view.View.layout (View.java:24969)
at android.view.ViewGroup.layout (ViewGroup.java:6784)
at android.widget.FrameLayout.layoutChildren (FrameLayout.java:332)
at android.widget.FrameLayout.onLayout (FrameLayout.java:270)
at android.view.View.layout (View.java:24969)
at android.view.ViewGroup.layout (ViewGroup.java:6784)
at android.widget.FrameLayout.layoutChildren (FrameLayout.java:332)
at android.widget.FrameLayout.onLayout (FrameLayout.java:270)
at android.view.View.layout (View.java:24969)
at android.view.ViewGroup.layout (ViewGroup.java:6784)
at org.nativescript.widgets.CommonLayoutParams.layoutChild (CommonLayoutParams.java:222)
at org.nativescript.widgets.GridLayout.onLayout (GridLayout.java:425)
at android.view.View.layout (View.java:24969)
at android.view.ViewGroup.layout (ViewGroup.java:6784)
at org.nativescript.widgets.CommonLayoutParams.layoutChild (CommonLayoutParams.java:222)
at org.nativescript.widgets.ContentLayout.onLayout (ContentLayout.java:80)
at android.view.View.layout (View.java:24969)
at android.view.ViewGroup.layout (ViewGroup.java:6784)
at android.widget.FrameLayout.layoutChildren (FrameLayout.java:332)
at android.widget.FrameLayout.onLayout (FrameLayout.java:270)
at android.view.View.layout (View.java:24969)
at android.view.ViewGroup.layout (ViewGroup.java:6784)
at android.widget.LinearLayout.setChildFrame (LinearLayout.java:1829)
at android.widget.LinearLayout.layoutVertical (LinearLayout.java:1673)
at android.widget.LinearLayout.onLayout (LinearLayout.java:1582)
at android.view.View.layout (View.java:24969)
at android.view.ViewGroup.layout (ViewGroup.java:6784)
at android.widget.FrameLayout.layoutChildren (FrameLayout.java:332)
at android.widget.FrameLayout.onLayout (FrameLayout.java:270)
at android.view.View.layout (View.java:24969)
at android.view.ViewGroup.layout (ViewGroup.java:6784)
at android.widget.LinearLayout.setChildFrame (LinearLayout.java:1829)
at android.widget.LinearLayout.layoutVertical (LinearLayout.java:1673)
at android.widget.LinearLayout.onLayout (LinearLayout.java:1582)
at android.view.View.layout (View.java:24969)
at android.view.ViewGroup.layout (ViewGroup.java:6784)
at android.widget.FrameLayout.layoutChildren (FrameLayout.java:332)
at android.widget.FrameLayout.onLayout (FrameLayout.java:270)
at com.android.internal.policy.DecorView.onLayout (DecorView.java:1431)
at android.view.View.layout (View.java:24969)
at android.view.ViewGroup.layout (ViewGroup.java:6784)
at android.view.ViewRootImpl.performLayout (ViewRootImpl.java:4917) <-- THIS IS WHERE THE CRASH SEEMS TO GENERATE
at android.view.ViewRootImpl.performTraversals (ViewRootImpl.java:4240)
at android.view.ViewRootImpl.doTraversal (ViewRootImpl.java:3116)
at android.view.ViewRootImpl$TraversalRunnable.run (ViewRootImpl.java:10885)
at android.view.Choreographer$CallbackRecord.run (Choreographer.java:1301)
at android.view.Choreographer$CallbackRecord.run (Choreographer.java:1309)
at android.view.Choreographer.doCallbacks (Choreographer.java:923)
at android.view.Choreographer.doFrame (Choreographer.java:852)
at android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:1283)
at android.os.Handler.handleCallback (Handler.java:942)
at android.os.Handler.dispatchMessage (Handler.java:99)
at android.os.Looper.loopOnce (Looper.java:226)
at android.os.Looper.loop (Looper.java:313)
at android.app.ActivityThread.main (ActivityThread.java:8762)
at java.lang.reflect.Method.invoke (Native method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:604)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1067)
Other thing to point out, is that im using the xml implementation like this
<nsDrawer:RadSideDrawer.mainContent>
<AbsoluteLayout backgroundColor="#F4F9F9">
<MaterialBottomNavigation:BottomNavigation top="0" left="0" width="100%" height="100%" id="bottomNav" selectedIndex="0">
<MaterialBottomNavigation:TabStrip id="mainTabStrip" class="bottomtabs-tabstrip" iosIconRenderingMode="alwaysOriginal" isIconSizeFixed="true">
<MaterialBottomNavigation:TabStripItem class="bottomtabs-tabstrip-item">
<Image id="home-tab-image" class="bottomtabs-image" src="~/images/common/icon-treehouse-blue.png"/>
<Label id="home-tab-label" class="bottomtabs-label selected" text=""/>
</MaterialBottomNavigation:TabStripItem>
<MaterialBottomNavigation:TabStripItem class="bottomtabs-tabstrip-item">
<Image id="challenges-tab-image" class="bottomtabs-image" src="~/images/common/icon-challenge.png"/>
<Label id="challenges-tab-label" class="bottomtabs-label unselected" text=""/>
</MaterialBottomNavigation:TabStripItem>
<MaterialBottomNavigation:TabStripItem class="bottomtabs-tabstrip-item">
<Image id="friends-tab-image" class="bottomtabs-image" src="~/images/common/icon-friends.png"/>
<Label id="friends-tab-label" class="bottomtabs-label unselected" text=""/>
</MaterialBottomNavigation:TabStripItem>
<MaterialBottomNavigation:TabStripItem class="bottomtabs-tabstrip-item">
<Image id="chat-tab-image" class="bottomtabs-image" src="~/images/common/icon-chat.png"/>
<Label id="chat-tab-label" class="bottomtabs-label unselected" text=""/>
</MaterialBottomNavigation:TabStripItem>
</MaterialBottomNavigation:TabStrip>
<MaterialBottomNavigation:TabContentItem>
<Frame id="frame-home" width="100%" height="100%" defaultPage="views/home-page/home-page"/>
</MaterialBottomNavigation:TabContentItem>
<MaterialBottomNavigation:TabContentItem>
<Frame id="frame-challenges" width="100%" height="100%" defaultPage="views/challenges-page/challenges-page"/>
</MaterialBottomNavigation:TabContentItem>
<MaterialBottomNavigation:TabContentItem>
<Frame id="frame-friends" width="100%" height="100%" defaultPage="views/friends-page/friends-page"/>
</MaterialBottomNavigation:TabContentItem>
<MaterialBottomNavigation:TabContentItem>
<Frame id="frame-chat" width="100%" height="100%" defaultPage="views/chat-page/chat-page"/>
</MaterialBottomNavigation:TabContentItem>
</MaterialBottomNavigation:BottomNavigation>
@PsHye could you please create a simple reproducible project?