与Recycler视图的Android奇怪问题

时间:2017-01-19 06:14:24

标签: android android-recyclerview

在我的应用中,我在使用recyclerview时遇到了一个奇怪的问题。以下是Crashlytics的崩溃日志:

Fatal Exception: java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid item position 0(offset:4).state:5
   at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4368)
   at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4326)
   at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:1955)
   at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1364)
   at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1327)
   at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:556)
   at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2667)
   at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3011)
   at android.view.View.layout(View.java:16653)
   at android.view.ViewGroup.layout(ViewGroup.java:5438)
   at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
   at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586)
   at android.widget.LinearLayout.onLayout(LinearLayout.java:1495)
   at android.view.View.layout(View.java:16653)
   at android.view.ViewGroup.layout(ViewGroup.java:5438)
   at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
   at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
   at android.view.View.layout(View.java:16653)
   at android.view.ViewGroup.layout(ViewGroup.java:5438)
   at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
   at android.widget.LinearLayout.layoutHorizontal(LinearLayout.java:1732)
   at android.widget.LinearLayout.onLayout(LinearLayout.java:1497)
   at android.view.View.layout(View.java:16653)
   at android.view.ViewGroup.layout(ViewGroup.java:5438)
   at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1080)
   at android.view.View.layout(View.java:16653)
   at android.view.ViewGroup.layout(ViewGroup.java:5438)
   at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
   at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
   at android.view.View.layout(View.java:16653)
   at android.view.ViewGroup.layout(ViewGroup.java:5438)
   at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
   at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
   at android.view.View.layout(View.java:16653)
   at android.view.ViewGroup.layout(ViewGroup.java:5438)
   at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
   at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
   at android.view.View.layout(View.java:16653)
   at android.view.ViewGroup.layout(ViewGroup.java:5438)
   at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:907)
   at android.view.View.layout(View.java:16653)
   at android.view.ViewGroup.layout(ViewGroup.java:5438)
   at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
   at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
   at android.view.View.layout(View.java:16653)
   at android.view.ViewGroup.layout(ViewGroup.java:5438)
   at com.android.internal.widget.ActionBarOverlayLayout.onLayout(ActionBarOverlayLayout.java:493)
   at android.view.View.layout(View.java:16653)
   at android.view.ViewGroup.layout(ViewGroup.java:5438)
   at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
   at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
   at com.android.internal.policy.PhoneWindow$DecorView.onLayout(PhoneWindow.java:2678)
   at android.view.View.layout(View.java:16653)
   at android.view.ViewGroup.layout(ViewGroup.java:5438)
   at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2198)
   at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1958)
   at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1134)
   at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6045)
   at android.view.Choreographer$CallbackRecord.run(Choreographer.java:860)
   at android.view.Choreographer.doCallbacks(Choreographer.java:672)
   at android.view.Choreographer.doFrame(Choreographer.java:608)
   at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:846)
   at android.os.Handler.handleCallback(Handler.java:739)
   at android.os.Handler.dispatchMessage(Handler.java:95)
   at android.os.Looper.loop(Looper.java:148)
   at android.app.ActivityThread.main(ActivityThread.java:5441)
   at java.lang.reflect.Method.invoke(Method.java)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:738)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:628)

在过去的3个月里,由于这个问题,很多用户受到了影响。崩溃日志没有任何对我项目中任何文件的引用。我不知道应该如何重现这个问题。有几个地方我在应用程序中使用Recycler视图。

0 个答案:

没有答案