Netvent/storyly-sdk

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

Closed this issue · 1 comments

Recently we have started seeing crashes on Storyly SDK in our Crash Reporter Tool. We cannot reproduce it. It started occurring in the app in which we:

  • bumped up Storyly SDK version to 2.4.0,
  • implemented scrolling to the first item in the list on storylyLoaded callback (since it wasn't working for updating labels)
  • added our custom Storyly group view with ConstraintLayout as a parent layout.

Stacktrace:

java.lang.IllegalArgumentException: Tmp detached view should be removed from RecyclerView before it can be recycled: a{985d1eb position=2 id=-1, oldPos=-1, pLpos:-1 removed tmpDetached no parent} com.appsamurai.storyly.storylylist.StorylyListRecyclerView{5c1db23 VFED..... ........ 0,0-1080,310 #7f0a031b app:id/st_storyly_list_recycler_view}, adapter:androidx.recyclerview.widget.ConcatAdapter@4612820, layout:com.appsamurai.storyly.storylylist.StorylyListRecyclerView$1@5805d9, context:com.example.MainActivity@9d0d174
	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:1115)
	at android.animation.Animator$AnimatorListener.onAnimationEnd()(Animator.java:600)
	at android.animation.ValueAnimator.endAnimation()(ValueAnimator.java:1333)
	at android.animation.ValueAnimator.doAnimationFrame()(ValueAnimator.java:1575)
	at android.animation.AnimationHandler.doAnimationFrame()(AnimationHandler.java:307)
	at android.animation.AnimationHandler.-$$Nest$mdoAnimationFrame()(AnimationHandler.java:0)
	at android.animation.AnimationHandler$1.doFrame()(AnimationHandler.java:86)
	at android.view.Choreographer$CallbackRecord.run()(Choreographer.java:1299)
	at android.view.Choreographer$CallbackRecord.run()(Choreographer.java:1309)
	at android.view.Choreographer.doCallbacks()(Choreographer.java:923)
	at android.view.Choreographer.doFrame()(Choreographer.java:847)
	at android.view.Choreographer$FrameDisplayEventReceiver.run()(Choreographer.java:1283)
	at android.os.Handler.handleCallback()(Handler.java:942)
	at android.os.Handler.dispatchMessage()(Handler.java:99)
	at android.os.Looper.loopOnce()(Looper.java:226)
	at android.os.Looper.loop()(Looper.java:313)
	at android.app.ActivityThread.main()(ActivityThread.java:8762)
	at java.lang.reflect.Method.invoke()(Method.java:-2)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run()(RuntimeInit.java:604)
	at com.android.internal.os.ZygoteInit.main()(ZygoteInit.java:1067)

Environment Details

Storyly SDK Version: 2.4.0
Android SDK Version: All versions from Android 10 to Android 13
Device Model: Different models: Samsung, Motorolla etc

Current Behavior

The app is crashing.

Steps to Reproduce

We haven't been able to reproduce it. But it looks like it can be related to scrolling to the first item in the list on storylyLoaded callback.

Hi @mike192,

We’ve improved the scroll behavior of storyly bar in Storyly Android SDK@2.5.1, so it’s suggested to remove scroll method call in storylyLoaded. Please update and check the results. Let us know if the issue persists.

Thanks