rive-app/rive-android

Rive animations crash x86 emulator

Closed this issue · 2 comments

Description

My team recently decided to switch from Lottie to Rive at our designer's request. On actual devices and Mac development environments, the switch has been seamless, however in my Windows environments (tested on 2 machines) the emulator now crashes every time we load the app and run an animation (app runs fine until we get to the screen which runs the animation - but for most use cases we launch an animation on the first screen) - which is a nightmare for development.

I hoping there is a known fix / workaround that maybe I'm not aware of.

Update: It looks like x86_64 emulators work ok, it's the x86 emulators that crash
Update 2: On the Google Play Store they test with an x86 emulator and it reports the crash in Rive in the pre-launch report.

Rive 9.0.7

Provide a Repro

 <app.rive.runtime.kotlin.RiveAnimationView
        android:id="@+id/animation_truck"
        android:layout_width="0dp"
        android:layout_height="88dp"
        android:layout_marginTop="@dimen/spacing_large"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:riveAutoPlay="true"
        app:riveLoop="LOOP"
        app:riveResource="@raw/truck_stop_loader" />

containerWithThisView.visibility = VISIBLE or GONE

Expected behavior

Show animation (works on Mac-based emulator and real devices)

Screenshots

N/A

Device & Versions (please complete the following information)

Android Emulators:

  • Nexus 5X API 25 x86
  • Pixel 3a API 30 x86
  • Play Store Testing: Google Pixel 2 (virtual) 1080x1920 Android 9 (SDK 28) x86 es_ES

Update: I was trying different flavors of the emulator to get a more complete description and discovered Rive appears to work fine on Pixel 3a API 32 x86_64 - so maybe the issue only exists on x86 emulators but works on x86_64 emulators?

Additional context

Stack Trace of crash when trying to show an animation on x86:

A  art/runtime/java_vm_ext.cc:470] JNI DETECTED ERROR IN APPLICATION: JNI FindClass called with pending exception java.lang.IndexOutOfBoundsException: Invalid class app.rive.runtime.kotlin.core.RendererType$Companion index value 2097181. It must be between 0 and 2
A  art/runtime/java_vm_ext.cc:470]   at app.rive.runtime.kotlin.core.RendererType app.rive.runtime.kotlin.core.RendererType$Companion.fromIndex(int) (RendererType.kt:12)
A  art/runtime/java_vm_ext.cc:470]   at void app.rive.runtime.kotlin.core.FileAsset.<init>(long, int) (FileAsset.kt:4)
A  art/runtime/java_vm_ext.cc:470]   at long app.rive.runtime.kotlin.core.File.import(byte[], int, int, long) (File.kt:-2)
A  art/runtime/java_vm_ext.cc:470]   at void app.rive.runtime.kotlin.core.File.<init>(byte[], app.rive.runtime.kotlin.core.RendererType, app.rive.runtime.kotlin.core.FileAssetLoader) (File.kt:30)
A  art/runtime/java_vm_ext.cc:470]   at void app.rive.runtime.kotlin.RiveAnimationView.loadFileFromResource(kotlin.jvm.functions.Function1) (RiveAnimationView.kt:402)
A  art/runtime/java_vm_ext.cc:470]   at void app.rive.runtime.kotlin.RiveAnimationView.<init>(android.content.Context, android.util.AttributeSet) (RiveAnimationView.kt:339)
A  art/runtime/java_vm_ext.cc:470]   at java.lang.Object java.lang.reflect.Constructor.newInstance0!(java.lang.Object[]) (Constructor.java:-2)
A  art/runtime/java_vm_ext.cc:470]   at java.lang.Object java.lang.reflect.Constructor.newInstance(java.lang.Object[]) (Constructor.java:430)
A  art/runtime/java_vm_ext.cc:470]   at android.view.View android.view.LayoutInflater.createView(java.lang.String, java.lang.String, android.util.AttributeSet) (LayoutInflater.java:645)
A  art/runtime/java_vm_ext.cc:470]   at android.view.View android.view.LayoutInflater.createViewFromTag(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet, boolean) (LayoutInflater.java:787)
A  art/runtime/java_vm_ext.cc:470]   at android.view.View android.view.LayoutInflater.createViewFromTag(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet) (LayoutInflater.java:727)
A  art/runtime/java_vm_ext.cc:470]   at void android.view.LayoutInflater.rInflate(org.xmlpull.v1.XmlPullParser, android.view.View, android.content.Context, android.util.AttributeSet, boolean) (LayoutInflater.java:858)
A  art/runtime/java_vm_ext.cc:470]   at void android.view.LayoutInflater.rInflateChildren(org.xmlpull.v1.XmlPullParser, android.view.View, android.util.AttributeSet, boolean) (LayoutInflater.java:821)
A  art/runtime/java_vm_ext.cc:470]   at void android.view.LayoutInflater.parseInclude(org.xmlpull.v1.XmlPullParser, android.content.Context, android.view.View, android.util.AttributeSet) (LayoutInflater.java:994)
A  art/runtime/java_vm_ext.cc:470]   at void android.view.LayoutInflater.rInflate(org.xmlpull.v1.XmlPullParser, android.view.View, android.content.Context, android.util.AttributeSet, boolean) (LayoutInflater.java:854)
A  art/runtime/java_vm_ext.cc:470]   at void android.view.LayoutInflater.rInflateChildren(org.xmlpull.v1.XmlPullParser, android.view.View, android.util.AttributeSet, boolean) (LayoutInflater.java:821)
A  art/runtime/java_vm_ext.cc:470]   at void android.view.LayoutInflater.rInflate(org.xmlpull.v1.XmlPullParser, android.view.View, android.content.Context, android.util.AttributeSet, boolean) (LayoutInflater.java:861)
A  art/runtime/java_vm_ext.cc:470]   at void android.view.LayoutInflater.rInflateChildren(org.xmlpull.v1.XmlPullParser, android.view.View, android.util.AttributeSet, boolean) (LayoutInflater.java:821)
A  art/runtime/java_vm_ext.cc:470]   at android.view.View android.view.LayoutInflater.inflate(org.xmlpull.v1.XmlPullParser, android.view.ViewGroup, boolean) (LayoutInflater.java:518)
A  art/runtime/java_vm_ext.cc:470]   at android.view.View android.view.LayoutInflater.inflate(int, android.view.ViewGroup, boolean) (LayoutInflater.java:426)
A  art/runtime/java_vm_ext.cc:470]   at com.mycompany.databinding.MyFragment.inflate(android.view.LayoutInflater, android.view.ViewGroup, boolean) (FragmentFindFuelBinding.java:96)
A  art/runtime/java_vm_ext.cc:470]   at android.view.View com.mycompany.MyFragment.onCreateView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle) (FindFuelFragment.kt:134)
A  art/runtime/java_vm_ext.cc:470]   at void androidx.fragment.app.Fragment.performCreateView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle) (Fragment.java:3114)
A  art/runtime/java_vm_ext.cc:470]   at void androidx.fragment.app.FragmentStateManager.createView() (FragmentStateManager.java:557)
A  art/runtime/java_vm_ext.cc:470]   at void androidx.fragment.app.FragmentStateManager.moveToExpectedState() (FragmentStateManager.java:272)
A  art/runtime/java_vm_ext.cc:470]   at void androidx.fragment.app.FragmentManager.executeOpsTogether(java.util.ArrayList, java.util.ArrayList, int, int) (FragmentManager.java:1943)
A  art/runtime/java_vm_ext.cc:470]   at void androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(java.util.ArrayList, java.util.ArrayList) (FragmentManager.java:1839)
A  art/runtime/java_vm_ext.cc:470]   at void androidx.fragment.app.FragmentManager.execSingleAction(androidx.fragment.app.FragmentManager$OpGenerator, boolean) (FragmentManager.java:1751)
A  art/runtime/java_vm_ext.cc:470]   at void androidx.fragment.app.BackStackRecord.commitNow() (BackStackRecord.java:317)
A  art/runtime/java_vm_ext.cc:470]   at void androidx.viewpager2.adapter.FragmentStateAdapter.placeFragmentInViewHolder(androidx.viewpager2.adapter.FragmentViewHolder) (FragmentStateAdapter.java:343)
A  art/runtime/java_vm_ext.cc:470]   at void androidx.viewpager2.adapter.FragmentStateAdapter.onViewAttachedToWindow(androidx.viewpager2.adapter.FragmentViewHolder) (FragmentStateAdapter.java:274)
A  art/runtime/java_vm_ext.cc:470]   at void androidx.viewpager2.adapter.FragmentStateAdapter.onViewAttachedToWindow(androidx.recyclerview.widget.RecyclerView$ViewHolder) (FragmentStateAdapter.java:74)
A  art/runtime/java_vm_ext.cc:470]   at void androidx.recyclerview.widget.RecyclerView.dispatchChildAttached(android.view.View) (RecyclerView.java:8377)
A  art/runtime/java_vm_ext.cc:470]   at void androidx.recyclerview.widget.RecyclerView$5.addView(android.view.View, int) (RecyclerView.java:954)
A  art/runtime/java_vm_ext.cc:470]   at void androidx.recyclerview.widget.ChildHelper.addView(android.view.View, int, boolean) (ChildHelper.java:131)
A  art/runtime/java_vm_ext.cc:470]   at void androidx.recyclerview.widget.RecyclerView$LayoutManager.addViewInt(android.view.View, int, boolean) (RecyclerView.java:9430)
A  art/runtime/java_vm_ext.cc:470]   at void androidx.recyclerview.widget.RecyclerView$LayoutManager.addView(android.view.View, int) (RecyclerView.java:9388)
A  art/runtime/java_vm_ext.cc:470]   at void androidx.recyclerview.widget.RecyclerView$LayoutManager.addView(android.view.View) (RecyclerView.java:9375)
A  art/runtime/java_vm_ext.cc:470]   at void androidx.recyclerview.widget.LinearLayoutManager.layoutChunk(androidx.recyclerview.widget.RecyclerView$Recycler, androidx.recyclerview.widget.RecyclerView$State, androidx.recyclerview.widget.LinearLayoutManager$LayoutState, androidx.recyclerview.widget.LinearLayoutManager$LayoutChunkResult) (LinearLayoutManager.java:1676)
A  art/runtime/java_vm_ext.cc:470]   at int androidx.recyclerview.widget.LinearLayoutManager.fill(androidx.recyclerview.widget.RecyclerView$Recycler, androidx.recyclerview.widget.LinearLayoutManager$LayoutState, androidx.recyclerview.widget.RecyclerView$State, boolean) (LinearLayoutManager.java:1622)
A  art/runtime/java_vm_ext.cc:470]   at void androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(androidx.recyclerview.widget.RecyclerView$Recycler, androidx.recyclerview.widget.RecyclerView$State) (LinearLayoutManager.java:687)
A  art/runtime/java_vm_ext.cc:470]   at void androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2() (RecyclerView.java:4645)
A  art/runtime/java_vm_ext.cc:470]   at void androidx.recyclerview.widget.RecyclerView.dispatchLayout() (RecyclerView.java:4348)
A  art/runtime/java_vm_ext.cc:470]   at void androidx.recyclerview.widget.RecyclerView.onLayout(boolean, int, int, int, int) (RecyclerView.java:4919)
A  art/runtime/java_vm_ext.cc:470]   at void android.view.View.layout(int, int, int, int) (View.java:17637)
A  art/runtime/java_vm_ext.cc:470]   at void android.view.ViewGroup.layout(int, int, int, int) (ViewGroup.java:5575)
A  art/runtime/java_vm_ext.cc:470]   at void androidx.viewpager2.widget.ViewPager2.onLayout(boolean, int, int, int, int) (ViewPager2.java:535)
A  art/runtime/java_vm_ext.cc:470]   at void android.view.View.layout(int, int, int, int) (View.java:17637)
A  art/runtime/java_vm_ext.cc:470]   at void android.view.ViewGroup.layout(int, int, int, int) (ViewGroup.java:5575)
A  art/runtime/java_vm_ext.cc:470]   at void androidx.constraintlayout.widget.ConstraintLayout.onLayout(boolean, int, int, int, int) (ConstraintLayout.java:1873)
A  art/runtime/java_vm_ext.cc:470]   at void android.view.View.layout(int, int, int, int) (View.java:17637)
A  art/runtime/java_vm_ext.cc:470]   at void android.view.ViewGroup.layout(int, int, int, int) (ViewGroup.java:5575)
A  art/runtime/java_vm_ext.cc:470]   at void android.widget.FrameLayout.layoutChildren(int, int, int, int, boolean) (FrameLayout.java:323)
A  art/runtime/java_vm_ext.cc:470]   at void android.widget.FrameLayout.onLayout(boolean, int, int, int, int) (FrameLayout.java:261)
A  art/runtime/java_vm_ext.cc:470]   at void android.view.View.layout(int, int, int, int) (View.java:17637)
A  art/runtime/java_vm_ext.cc:470]   at void android.view.ViewGroup.layout(int, int, int, int) (ViewGroup.java:5575)
A  art/runtime/java_vm_ext.cc:470]   at void android.widget.LinearLayout.setChildFrame(android.view.View, int, int, int, int) (LinearLayout.java:1741)
A  art/runtime/java_vm_ext.cc:470]   at void android.widget.LinearLayout.layoutVertical(int, int, int, int) (LinearLayout.java:1585)
A  art/runtime/java_vm_ext.cc:470]   at void android.widget.LinearLayout.onLayout(boolean, int, int, int, int) (LinearLayout.java:1494)
A  art/runtime/java_vm_ext.cc:470]   at void android.view.View.layout(int, int, int, int) (View.java:17637)
A  art/runtime/java_vm_ext.cc:470]   at  A  art/runtime/java_vm_ext.cc:470]   at void android.widget.FrameLayout.layoutChildren(int, int, int, int, boolean) (FrameLayout.java:323)
A  art/runtime/java_vm_ext.cc:470]   at void android.widget.FrameLayout.onLayout(boolean, int, int, int, int) (FrameLayout.java:261)
A  art/runtime/java_vm_ext.cc:470]   at void android.view.View.layout(int, int, int, int) (View.java:17637)
A  art/runtime/java_vm_ext.cc:470]   at void android.view.ViewGroup.layout(int, int, int, int) (ViewGroup.java:5575)
A  art/runtime/java_vm_ext.cc:470]   at void android.widget.LinearLayout.setChildFrame(android.view.View, int, int, int, int) (LinearLayout.java:1741)
A  art/runtime/java_vm_ext.cc:470]   at void android.widget.LinearLayout.layoutVertical(int, int, int, int) (LinearLayout.java:1585)
A  art/runtime/java_vm_ext.cc:470]   at void android.widget.LinearLayout.onLayout(boolean, int, int, int, int) (LinearLayout.java:1494)
A  art/runtime/java_vm_ext.cc:470]   at void android.view.View.layout(int, int, int, int) (View.java:17637)
A  art/runtime/java_vm_ext.cc:470]   at void android.view.ViewGroup.layout(int, int, int, int) (ViewGroup.java:5575)
A  art/runtime/java_vm_ext.cc:470]   at void android.widget.FrameLayout.layoutChildren(int, int, int, int, boolean) (FrameLayout.java:323)
A  art/runtime/java_vm_ext.cc:470]   at void android.widget.FrameLayout.onLayout(boolean, int, int, int, int) (FrameLayout.java:261)
A  art/runtime/java_vm_ext.cc:470]   at void com.android.internal.policy.DecorView.onLayout(boolean, int, int, int, int) (DecorView.java:726)
A  art/runtime/java_vm_ext.cc:470]   at void android.view.View.layout(int, int, int, int) (View.java:17637)
A  art/runtime/java_vm_ext.cc:470]   at void android.view.ViewGroup.layout(int, int, int, int) (ViewGroup.java:5575)
A  art/runtime/java_vm_ext.cc:470]   at void android.view.ViewRootImpl.performLayout(android.view.WindowManager$LayoutParams, int, int) (ViewRootImpl.java:2346)
A  art/runtime/java_vm_ext.cc:470]   at void android.view.ViewRootImpl.performTraversals() (ViewRootImpl.java:2068)
A  art/runtime/java_vm_ext.cc:470]   at void android.view.ViewRootImpl.doTraversal() (ViewRootImpl.java:1254)
A  art/runtime/java_vm_ext.cc:470]   at void android.view.ViewRootImpl$TraversalRunnable.run() (ViewRootImpl.java:6337)
A  art/runtime/java_vm_ext.cc:470]   at void android.view.Choreographer$CallbackRecord.run(long) (Choreographer.java:874)
A  art/runtime/java_vm_ext.cc:470]   at void android.view.Choreographer.doCallbacks(int, long) (Choreographer.java:686)
A  art/runtime/java_vm_ext.cc:470]   at void android.view.Choreographer.doFrame(long, int) (Choreographer.java:621)
A  art/runtime/java_vm_ext.cc:470]   at void android.view.Choreographer$FrameDisplayEventReceiver.run() (Choreographer.java:860)
A  art/runtime/java_vm_ext.cc:470]   at void android.os.Handler.handleCallback(android.os.Message) (Handler.java:751)
A  art/runtime/java_vm_ext.cc:470]   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:95)
A  art/runtime/java_vm_ext.cc:470]   at void android.os.Looper.loop() (Looper.java:154)
A  art/runtime/java_vm_ext.cc:470]   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6119)
A  art/runtime/java_vm_ext.cc:470]   at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
A  art/runtime/java_vm_ext.cc:470]   at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:886)
A  art/runtime/java_vm_ext.cc:470]   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:776)
A  art/runtime/java_vm_ext.cc:470] 
A  art/runtime/java_vm_ext.cc:470]     in call to FindClass
A  art/runtime/java_vm_ext.cc:470]     from long app.rive.runtime.kotlin.core.File.import(byte[], int, int, long)
A  art/runtime/java_vm_ext.cc:470] "main" prio=5 tid=1 Runnable
A  art/runtime/java_vm_ext.cc:470]   | group="main" sCount=0 dsCount=0 obj=0x7559ef60 self=0xa438b400
A  art/runtime/java_vm_ext.cc:470]   | sysTid=13578 nice=-4 cgrp=default sched=0/0 handle=0xa8741534
A  art/runtime/java_vm_ext.cc:470]   | state=R schedstat=( 0 0 0 ) utm=5 stm=250 core=2 HZ=100
A  art/runtime/java_vm_ext.cc:470]   | stack=0xbf327000-0xbf329000 stackSize=8MB
A  art/runtime/java_vm_ext.cc:470]   | held mutexes= "mutator lock"(shared held)

The Play Store emulator also generates a second crash:
ApkLibraryInstaller.installLibrary
Unable to get provider androidx.startup.InitializationProvider: androidx.startup.StartupException: com.getkeepsafe.relinker.MissingLibraryException: Could not find 'librive-android.so'. Looked for: [x86], but only found: [].

9.0.10 appears to fix the x86 emulator crash (and should fix Play Store validation)

Going to close this one too as this was the same as #308