Skip to content

RecyclerView crashing in some circumstances #240

Open
@donpwilson

Description

@donpwilson

I have been experimenting with "com.google.android:flexbox:0.3.0-alpha2" with a view to adding it to my photo app as an alternative way of displaying photos. I appreciate that this version is not yet fully stable.

I experience a crash in certain circumstances and report it here in the hope that your testing / debugging can resolve it.

I display a grid of photos and have buttons that enable the user to zoom in or out of the grid. These vary to height of each row. I get a crash on zoom in when the bottom photos are pushed out of view. I'm thinking that there is a confusion between being detached and being recycled. This crash also follows a warning message from View's requestLayout(). Here's the log:

03-29 11:47:42.833 21953-21953/com.dpw.photoplayer W/View: requestLayout() improperly called by android.support.v7.widget.AppCompatTextView{3c009ebc V.ED..C. ......ID 6,306-359,363 #7f100199 app:id/photo_text} during layout: running second layout pass
03-29 11:47:42.833 21953-21953/com.dpw.photoplayer W/View: requestLayout() improperly called by android.support.v7.widget.AppCompatTextView{3e090e45 V.ED.... ......ID 170,6-194,63 #7f100197 app:id/photo_count} during layout: running second layout pass
03-29 11:47:42.833 21953-21953/com.dpw.photoplayer W/View: requestLayout() improperly called by android.support.v7.widget.AppCompatImageView{3a92499a V.ED.... ......ID 6,6-552,366 #7f100193 app:id/photo_image} during layout: running second layout pass
03-29 11:47:42.833 21953-21953/com.dpw.photoplayer W/View: requestLayout() improperly called by android.support.v7.widget.AppCompatTextView{9d272cb V.ED..C. ......ID 110,306-448,363 #7f100199 app:id/photo_text} during layout: running second layout pass
03-29 11:47:42.833 21953-21953/com.dpw.photoplayer W/View: requestLayout() improperly called by android.support.v7.widget.AppCompatTextView{2196eaa8 V.ED.... ......ID 267,6-291,63 #7f100197 app:id/photo_count} during layout: running second layout pass
03-29 11:47:42.979 21953-21953/com.dpw.photoplayer E/AndroidRuntime: FATAL EXCEPTION: main
                                                                     Process: com.dpw.photoplayer, PID: 21953
                                                                     java.lang.IllegalArgumentException: Tmp detached view should be removed from RecyclerView before it can be recycled: ViewHolder{11587ca3 position=3 id=-776809114, oldPos=-1, pLpos:-1 tmpDetached no parent}
                                                                         at android.support.v7.widget.RecyclerView$Recycler.recycleViewHolderInternal(RecyclerView.java:5692)
                                                                         at android.support.v7.widget.RecyclerView.removeAnimatingView(RecyclerView.java:1279)
                                                                         at android.support.v7.widget.RecyclerView$ItemAnimatorRestoreListener.onAnimationFinished(RecyclerView.java:11518)
                                                                         at android.support.v7.widget.RecyclerView$ItemAnimator.dispatchAnimationFinished(RecyclerView.java:12018)
                                                                         at android.support.v7.widget.SimpleItemAnimator.dispatchRemoveFinished(SimpleItemAnimator.java:265)
                                                                         at android.support.v7.widget.DefaultItemAnimator$4.onAnimationEnd(DefaultItemAnimator.java:209)
                                                                         at android.support.v4.view.ViewPropertyAnimatorCompatJB$1.onAnimationEnd(ViewPropertyAnimatorCompatJB.java:51)
                                                                         at android.view.ViewPropertyAnimator$AnimatorEventListener.onAnimationEnd(ViewPropertyAnimator.java:1116)
                                                                         at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1171)
                                                                         at android.animation.ValueAnimator$AnimationHandler.doAnimationFrame(ValueAnimator.java:722)
                                                                         at android.animation.ValueAnimator$AnimationHandler.run(ValueAnimator.java:738)
                                                                         at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
                                                                         at android.view.Choreographer.doCallbacks(Choreographer.java:580)
                                                                         at android.view.Choreographer.doFrame(Choreographer.java:549)
                                                                         at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
                                                                         at android.os.Handler.handleCallback(Handler.java:739)
                                                                         at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                         at android.os.Looper.loop(Looper.java:135)
                                                                         at android.app.ActivityThread.main(ActivityThread.java:5254)
                                                                         at java.lang.reflect.Method.invoke(Native Method)
                                                                         at java.lang.reflect.Method.invoke(Method.java:372)
                                                                         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
                                                                         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions