rive-app/rive-android

Crashing due to unhandled exception

shivamChawla8196 opened this issue · 3 comments

I am using this Rive in View Pager but when the fragment is destroyed in which rive is getting played the below exception occurs and the app crashes, is there a way to clear/release the Rive view so that crash does not occur...
**```
Process: com.somthing.debug, PID: 8084
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:641)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:978)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:631)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:978) 
Caused by: app.rive.runtime.kotlin.core.errors.RiveException: C++ object for app.rive.runtime.kotlin.core.LinearAnimationInstance@435ce0c does not exist. See MEMORY_MANAGEMENT.md for more information.
at app.rive.runtime.kotlin.core.NativeObject.getCppPointer(NativeOwner.kt:24)
at app.rive.runtime.kotlin.core.LinearAnimationInstance.getName(LinearAnimationInstance.kt:141)
at app.rive.runtime.kotlin.RiveArtboardRenderer._animations(RiveArtboardRenderer.kt:395)
at app.rive.runtime.kotlin.RiveArtboardRenderer._animations(RiveArtboardRenderer.kt:386)
at app.rive.runtime.kotlin.RiveArtboardRenderer._playAnimation(RiveArtboardRenderer.kt:430)
at app.rive.runtime.kotlin.RiveArtboardRenderer.play(RiveArtboardRenderer.kt:217)
at app.rive.runtime.kotlin.RiveAnimationView.play(RiveAnimationView.kt:356)
at app.rive.runtime.kotlin.RiveAnimationView.play$default(RiveAnimationView.kt:349)
at app.rive.runtime.kotlin.RiveAnimationView.onAttachedToWindow(RiveAnimationView.kt:537)
at android.view.View.dispatchAttachedToWindow(View.java:20626)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3521)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3521)
at android.view.ViewGroup.addViewInner(ViewGroup.java:5303)
at android.view.ViewGroup.addView(ViewGroup.java:5089)
at android.view.ViewGroup.addView(ViewGroup.java:5029)
at androidx.recyclerview.widget.RecyclerView$5.addView(RecyclerView.java:889)
at androidx.recyclerview.widget.ChildHelper.addView(ChildHelper.java:107)
at androidx.recyclerview.widget.RecyclerView$LayoutManager.addViewInt(RecyclerView.java:8902)
at androidx.recyclerview.widget.RecyclerView$LayoutManager.addView(RecyclerView.java:8860)
at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1647)
at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1591)
at androidx.recyclerview.widget.LinearLayoutManager.scrollBy(LinearLayoutManager.java:1395)
at androidx.recyclerview.widget.LinearLayoutManager.scrollHorizontallyBy(LinearLayoutManager.java:1124)
at androidx.recyclerview.widget.RecyclerView.scrollStep(RecyclerView.java:1969)
at androidx.recyclerview.widget.RecyclerView.scrollByInternal(RecyclerView.java:2071)
at androidx.recyclerview.widget.RecyclerView.onTouchEvent(RecyclerView.java:3531)
at androidx.viewpager2.widget.ViewPager2$RecyclerViewImpl.onTouchEvent(ViewPager2.java:991)
at android.view.View.dispatchTouchEvent(View.java:14389)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3137)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2800)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3143)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2814)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3143)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2814)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3143)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2814)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3143)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2814)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3143)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2814)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3143)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2814)

Hi @shivamChawla8196, we'd appreciate if you send over a few more details:

  • which rive-android version are you using? Currently, the latest is 4.3.2. If you're using an older version, you might to try upgrading it first.
  • Give us a clear minimal repro, possibly with the riv file that's causing the issue

We are also experiencing this crash as reported by Firebase Crashlytics. I have not been able to replicate it locally but this occurred on these two devices

  • Huawei P10 (Android 9) with 1.06 GB RAM available
  • Transsion Itel Vision 1 Pro (Android 10) with 590 MB RAM available

I don't think its a memory issue judging by the figures above.
They are still using version 4.2.0 of the library. I know the newest version is 8.4.0 but that crashes on Android API 21 as reported here

We are also experiencing this crash as reported by Firebase Crashlytics. I have not been able to replicate it locally but this occurred on these two devices

* Huawei P10 (Android 9) with 1.06 GB RAM available

* Transsion Itel Vision 1 Pro (Android 10) with 590 MB RAM available

I don't think its a memory issue judging by the figures above. They are still using version 4.2.0 of the library. I know the newest version is 8.4.0 but that crashes on Android API 21 as reported here

Alright, thanks for the report, we'll take a deeper look at #293