Android ViewPage2上的TransactionTooLargeException

Android ViewPage2上的TransactionTooLargeException,android,android-viewpager2,Android,Android Viewpager2,我看过很多关于ViewPager的问题,但现在它在ViewPager2上 我得到了一个java.lang.RuntimeException:android.os.TransactionTooLargeException:data parcel和ViewPager2。我已经看到这有助于确定这个异常可能来自何处。我的bundle是bestof_date并且非常低(0.1KB),但是android:support:fragments只是在不断增加 所有这些都来自ViewPager+Recyclervi

我看过很多关于ViewPager的问题,但现在它在ViewPager2

我得到了一个
java.lang.RuntimeException:android.os.TransactionTooLargeException:data parcel
和ViewPager2。我已经看到这有助于确定这个异常可能来自何处。我的bundle是
bestof_date
并且非常低(0.1KB),但是
android:support:fragments
只是在不断增加

所有这些都来自ViewPager+Recyclerview标准实现,使用
FragmentStateAdapter
,因为我可以有150多个选项卡

2021-05-14 17:08:16.373 com.my.application D/TooLargeTool: MainActivity.onSaveInstanceState wrote: Bundle167873131 contains 10 keys and measures 43.7 KB when serialized as a Parcel
    * com.google.app_measurement.screen_service = 0.2 KB
    * KEY_COMPONENT_ACTIVITY_RANDOM_OBJECT = 0.2 KB
    * android:viewHierarchyState = 1.9 KB
    * KEY_COMPONENT_ACTIVITY_REGISTERED_KEYS = 9.8 KB
    * androidx.lifecycle.BundlableSavedStateRegistry.key = 30.3 KB
    * KEY_COMPONENT_ACTIVITY_REGISTERED_RCS = 0.6 KB
    * KEY_COMPONENT_ACTIVITY_PENDING_RESULT = 0.1 KB
    * KEY_COMPONENT_ACTIVITY_LAUNCHED_KEYS = 0.1 KB
    * android:lastAutofillId = 0.1 KB
    * android:fragments = 0.4 KB
2021-05-14 17:08:16.482 com.my.application D/TooLargeTool: BestofVideosFragment.onSaveInstanceState wrote: Bundle168360416 contains 3 keys and measures 1.2 KB when serialized as a Parcel
    * androidx.lifecycle.BundlableSavedStateRegistry.key = 0.1 KB
    * android:view_registry_state = 0.2 KB
    * android:view_state = 0.9 KB
    * fragment arguments = Bundle87348377 contains 1 keys and measures 0.1 KB when serialized as a Parcel
    * bestof_date = 0.1 KB
2021-05-14 17:08:17.003 com.my.application D/TooLargeTool: BestofFragment.onSaveInstanceState wrote: Bundle113147201 contains 4 keys and measures 24.0 KB when serialized as a Parcel
    * android:support:fragments = 22.5 KB
    * androidx.lifecycle.BundlableSavedStateRegistry.key = 0.1 KB
    * android:view_registry_state = 0.2 KB
    * android:view_state = 1.2 KB
    * fragment arguments = Bundle176902886 contains 0 keys and measures 0.0 KB when serialized as a Parcel
2021-05-14 17:08:17.075 com.my.application D/TooLargeTool: NavHostFragment.onSaveInstanceState wrote: Bundle75010087 contains 7 keys and measures 29.1 KB when serialized as a Parcel
    * android:support:fragments = 26.9 KB
    * androidx.lifecycle.BundlableSavedStateRegistry.key = 0.1 KB
    * android-support-nav:fragment:defaultHost = 0.1 KB
    * android:view_registry_state = 0.2 KB
    * android-support-nav:fragment:graphId = 0.1 KB
    * android-support-nav:fragment:navControllerState = 1.5 KB
    * android:view_state = 0.1 KB
更新1: 在进一步搜索之后,我发现这是因为
FragmentStateAdapter
正在保存视图的状态,该状态会一直累积到我们达到最大容量并崩溃,有没有办法清除它