This is a very rare bug that's happening in my app. Users open SettingsActivity
and notice the app has frozen, after which it crashes (5 - 10s later?).
I have no idea how to proceed, I've tried debugging but can't reproduce the issue. I've seen other similar questions, but their stack traces had application methods that were the cause of an infinite loop. Here, there is no application code that's responsible (at least, the stack trace doesn't reveal anything)
Stack trace shows only a bunch of Android core library methods (View
, ViewGroup
, RecyclerView
), and has something to do with accessibility.
This perplexes me, since:
- I'm not using RecyclerView anywhere in
SettingsActivity
,SettingsFragment
, or their layouts - The only place I am using it, works perfectly, as proven by a few screenshots and videos users have sent me
- I haven't overriden any accessibility callbacks in any of my activities
- I added breakpoints in every method the stack trace shows, but those breakpoints were never hit. In any activity. (wtf)
Considering the stack trace doesn't show any custom classes/methods part of my codebase, how am I supposed to proceed? Is this a known bug in androidx.recyclerview
, for example?
I know for sure that the app crashes in SettingsActivity
, since Firebase tracks activities in Crashlytics for you. (the flow was MainActivity -> [AnyActivity] -> SettingsActivity -> <freeze> -> <crash>
).
Our entire team can't reproduce this issue (using the same exact Play Store version), but it seems like there are around 100 users that are experiencing this crash. All devices that show these fatal exceptions are being used by our team to debug, to no avail.
Stack trace
Fatal Exception: java.lang.StackOverflowError: stack size 8MB
at android.view.View.hasIdentityMatrix (View.java:14669)
at android.view.ViewGroup.getChildVisibleRect (ViewGroup.java:6138)
at android.view.ViewGroup.getChildVisibleRect (ViewGroup.java:6189)
at android.view.ViewGroup.getChildVisibleRect (ViewGroup.java:6189)
at android.view.ViewGroup.getChildVisibleRect (ViewGroup.java:6189)
at android.view.ViewGroup.getChildVisibleRect (ViewGroup.java:6189)
at android.view.ViewGroup.getChildVisibleRect (ViewGroup.java:6189)
at android.view.ViewGroup.getChildVisibleRect (ViewGroup.java:6189)
at android.view.ViewGroup.getChildVisibleRect (ViewGroup.java:6189)
at android.view.ViewGroup.getChildVisibleRect (ViewGroup.java:6189)
at android.view.ViewGroup.getChildVisibleRect (ViewGroup.java:6189)
at android.view.ViewGroup.getChildVisibleRect (ViewGroup.java:6121)
at android.view.View.getGlobalVisibleRect (View.java:16064)
at android.view.View.isVisibleToUser (View.java:9065)
at android.view.View.isVisibleToUser (View.java:9023)
at android.view.View.onInitializeAccessibilityNodeInfoInternal (View.java:8814)
at android.view.ViewGroup.onInitializeAccessibilityNodeInfoInternal (ViewGroup.java:3642)
at android.view.View$AccessibilityDelegate.onInitializeAccessibilityNodeInfo (View.java:27387)
at androidx.core.view.AccessibilityDelegateCompat.onInitializeAccessibilityNodeInfo (AccessibilityDelegateCompat.java:275)
at androidx.recyclerview.widget.RecyclerViewAccessibilityDelegate$ItemDelegate.onInitializeAccessibilityNodeInfo (RecyclerViewAccessibilityDelegate.java:124)
at androidx.recyclerview.widget.RecyclerViewAccessibilityDelegate$ItemDelegate.onInitializeAccessibilityNodeInfo (RecyclerViewAccessibilityDelegate.java:131)
at androidx.recyclerview.widget.RecyclerViewAccessibilityDelegate$ItemDelegate.onInitializeAccessibilityNodeInfo (RecyclerViewAccessibilityDelegate.java:131)
at androidx.recyclerview.widget.RecyclerViewAccessibilityDelegate$ItemDelegate.onInitializeAccessibilityNodeInfo (RecyclerViewAccessibilityDelegate.java:131)
at androidx.recyclerview.widget.RecyclerViewAccessibilityDelegate$ItemDelegate.onInitializeAccessibilityNodeInfo (RecyclerViewAccessibilityDelegate.java:131)
at androidx.recyclerview.widget.RecyclerViewAccessibilityDelegate$ItemDelegate.onInitializeAccessibilityNodeInfo (RecyclerViewAccessibilityDelegate.java:131)
at androidx.recyclerview.widget.RecyclerViewAccessibilityDelegate$ItemDelegate.onInitializeAccessibilityNodeInfo (RecyclerViewAccessibilityDelegate.java:131)
at androidx.recyclerview.widget.RecyclerViewAccessibilityDelegate$ItemDelegate.onInitializeAccessibilityNodeInfo (RecyclerViewAccessibilityDelegate.java:131)
at androidx.recyclerview.widget.RecyclerViewAccessibilityDelegate$ItemDelegate.onInitializeAccessibilityNodeInfo (RecyclerViewAccessibilityDelegate.java:131)
at androidx.recyclerview.widget.RecyclerViewAccessibilityDelegate$ItemDelegate.onInitializeAccessibilityNodeInfo (RecyclerViewAccessibilityDelegate.java:131)
at androidx.recyclerview.widget.RecyclerViewAccessibilityDelegate$ItemDelegate.onInitializeAccessibilityNodeInfo (RecyclerViewAccessibilityDelegate.java:131)
at androidx.core.view.AccessibilityDelegateCompat$AccessibilityDelegateAdapter.onInitializeAccessibilityNodeInfo (AccessibilityDelegateCompat.java:86)
at android.view.View.onInitializeAccessibilityNodeInfo (View.java:7776)
at android.view.View.createAccessibilityNodeInfoInternal (View.java:7737)
at android.view.View$AccessibilityDelegate.createAccessibilityNodeInfo (View.java:27485)
at android.view.View.createAccessibilityNodeInfo (View.java:7720)
at android.view.AccessibilityInteractionController$AccessibilityNodePrefetcher.prefetchDescendantsOfRealNode (AccessibilityInteractionController.java:1147)
at android.view.AccessibilityInteractionController$AccessibilityNodePrefetcher.prefetchAccessibilityNodeInfos (AccessibilityInteractionController.java:972)
at android.view.AccessibilityInteractionController.findAccessibilityNodeInfoByAccessibilityIdUiThread (AccessibilityInteractionController.java:336)
at android.view.AccessibilityInteractionController.access$400 (AccessibilityInteractionController.java:67)
at android.view.AccessibilityInteractionController$PrivateHandler.handleMessage (AccessibilityInteractionController.java:1324)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:193)
at android.app.ActivityThread.main (ActivityThread.java:6898)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:537)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:858)
SettingsActivity
public class SettingsActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings);
settingsFragment = new SettingsFragment();
getSupportFragmentManager().beginTransaction()
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE)
.replace(R.id.settings_container, settingsFragment, "Settings")
.commit();
... // also contains code to init an IAP helper,
// but that doesn't use RecyclerView either (obviously)
}
SettingsFragment
public class SettingsFragment extends PreferenceFragmentCompat implements OnPreferenceChangeListener {
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
...
addPreferencesFromResource(R.xml.preferences);
...
}