Netvent / storyly-sdk

Storyly allows mobile applications to have in-app stories in native iOS, native Android, React-Native, and Flutter platforms.
69 stars 40 forks source link

java.lang.IllegalArgumentException - Tmp detached view should be removed from RecyclerView before it can be recycled #361

Open dmitry-emets opened 6 months ago

dmitry-emets commented 6 months ago

I see a small amount of crashes on Storyly SDK in production but I can't find steps to reproduce the issue. Currently I am using version 2.16.1 but I see the same problem before update from version 2.10.1. This bug looks pretty similar to this one: https://github.com/Netvent/storyly-mobile/issues/320 but I don't use scroll to any item.

My config looks like this:

Stacktrace:

Fatal Exception: java.lang.IllegalArgumentException: Tmp detached view should be removed from RecyclerView before it can be recycled: a{d44164b position=2 id=-1, oldPos=-1, pLpos:-1 update tmpDetached no parent} com.appsamurai.storyly.storylylist.StorylyListRecyclerView{58d5722 VFED..... ......ID 0,0-1080,252 #7f0a0dbd app:id/st_storyly_list_recycler_view}, adapter:com.appsamurai.storyly.storylylist.StorylyListRecyclerView$c@4426a8b, layout:com.appsamurai.storyly.storylylist.StorylyListRecyclerView$2@a845b69, context:com.my.app.main.AppActivity@c7f7c68
       at androidx.recyclerview.widget.RecyclerView$Recycler.recycleViewHolderInternal(RecyclerView.java:7077)
       at androidx.recyclerview.widget.RecyclerView.removeAnimatingView(RecyclerView.java:1597)
       at androidx.recyclerview.widget.RecyclerView$ItemAnimatorRestoreListener.onAnimationFinished(RecyclerView.java:13655)
       at androidx.recyclerview.widget.RecyclerView$ItemAnimator.dispatchAnimationFinished(RecyclerView.java:14157)
       at androidx.recyclerview.widget.SimpleItemAnimator.dispatchAddFinished(SimpleItemAnimator.java:312)
       at androidx.recyclerview.widget.DefaultItemAnimator$5.onAnimationEnd(DefaultItemAnimator.java:251)
       at android.view.ViewPropertyAnimator$AnimatorEventListener.onAnimationEnd(ViewPropertyAnimator.java:1115)
       at android.animation.Animator$AnimatorListener.onAnimationEnd(Animator.java:711)
       at android.animation.Animator$AnimatorCaller$$ExternalSyntheticLambda1.call(:4)
       at android.animation.Animator.callOnList(Animator.java:669)
       at android.animation.Animator.notifyListeners(Animator.java:608)
       at android.animation.Animator.notifyEndListeners(Animator.java:633)
       at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1306)
       at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1566)
       at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:344)
       at android.animation.AnimationHandler.-$$Nest$mdoAnimationFrame()
       at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:87)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1341)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1352)
       at android.view.Choreographer.doCallbacks(Choreographer.java:952)
       at android.view.Choreographer.doFrame(Choreographer.java:878)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1326)
       at android.os.Handler.handleCallback(Handler.java:958)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loopOnce(Looper.java:205)
       at android.os.Looper.loop(Looper.java:294)
       at android.app.ActivityThread.main(ActivityThread.java:8248)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)

Environment Details

Storyly SDK Version: 2.16.1 Android SDK Version: 34 Device Model: Different models Device OS Version: All versions from Android 7 to Android 14

Current Behavior

The app is crashing

Steps to Reproduce

I can't find a steps to reproduce this issue

vaibhav-reddoorz commented 3 months ago

Same issue is persist in latest version i.e 3.2.0

      Fatal Exception: java.lang.IllegalArgumentException: Tmp detached view should be removed from RecyclerView before it can be recycled: yUlEn2vg80{ec9b5b6 position=2 id=-1, oldPos=-1, pLpos:-1 update removed tmpDetached no parent} ta9{e61375f VFED..... ......ID 0,0-720,196 #7f0a0d0e app:id/st_storyly_list_recycler_view}, adapter:ta9$vZAIUmffYj@bdb5ac, layout:com.appsamurai.storyly.storylylist.StorylyListRecyclerView$2@d28f275, context:gca@133bb6a
   at androidx.recyclerview.widget.RecyclerView$Recycler.recycleViewHolderInternal(RecyclerView.java:6620)
   at androidx.recyclerview.widget.RecyclerView.removeAnimatingView(RecyclerView.java:1525)
   at androidx.recyclerview.widget.RecyclerView$ItemAnimatorRestoreListener.onAnimationFinished(RecyclerView.java:13109)
   at androidx.recyclerview.widget.RecyclerView$ItemAnimator.dispatchAnimationFinished(RecyclerView.java:13611)
   at androidx.recyclerview.widget.SimpleItemAnimator.dispatchAddFinished(SimpleItemAnimator.java:302)
   at androidx.recyclerview.widget.DefaultItemAnimator$5.onAnimationEnd(DefaultItemAnimator.java:247)
   at android.view.ViewPropertyAnimator$AnimatorEventListener.onAnimationEnd(ViewPropertyAnimator.java:1111)
   at android.animation.Animator$AnimatorListener.onAnimationEnd(Animator.java:554)
   at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1250)
   at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1492)
   at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:146)
   at android.animation.AnimationHandler.access$100(AnimationHandler.java:37)
   at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:54)
   at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1008)
   at android.view.Choreographer.doCallbacks(Choreographer.java:809)
   at android.view.Choreographer.doFrame(Choreographer.java:740)
   at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:995)
   at android.os.Handler.handleCallback(Handler.java:938)
   at android.os.Handler.dispatchMessage(Handler.java:99)
   at android.os.Looper.loop(Looper.java:246)
   at android.app.ActivityThread.main(ActivityThread.java:8653)
   at java.lang.reflect.Method.invoke(Method.java)
   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)