rive-app / rive-android

A runtime for interactive animations on Android
https://rive.app
MIT License
332 stars 30 forks source link

Rive crashes on 2 devices Samsung Galaxy A13 5G and Motorola moto g pure #308

Closed jt-gilkeson closed 6 months ago

jt-gilkeson commented 7 months ago

Description

We replaced Lottie with Rive last week and it worked for 99% of our install base, but crashed for multiple users that have the Samsung Galaxy A13 5G and one user who has the Motorola moto g pure.

We had to do a hotfix to rollback to lottie because of this.

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

Source .riv/.rev file

Removed

Expected behavior

Animation plays and app works normally.

Device & Versions (please complete the following information)

Additional context

Saw the same problem on x86 emulators (reported in https://github.com/rive-app/rive-android/issues/307) but this is more serious in that it is happening in end users real devices.

umberto-sonnino commented 7 months ago

Hi @jt-gilkeson is this the same crash (i.e. same stack trace) as #307? Are those devices this is crashing on also x86?

jt-gilkeson commented 7 months ago

@umberto-sonnino It happens in the same place - customers called in and reported it was happening when the initial loader should be shown (we don't have any crash reporting - the crash reporting tools evidently can't report this because it is happening in the native libraries), the trace I have in 307 was from Android Studio since I could see it happen in logcat on the emulator, but the devices are real phones in the field not x86 emulators.

umberto-sonnino commented 7 months ago

@umberto-sonnino It happens in the same place - customers called in and reported it was happening when the initial loader should be shown (we don't have any crash reporting - the crash reporting tools evidently can't report this because it is happening in the native libraries), the trace I have in 307 was from Android Studio sine I could see it happen in the emulator, but the devices are real phones in the field not x86 emulators.

Thanks for giving us those details, I'm going to try to get my hands on one of those devices and investigate it first hand

jt-gilkeson commented 7 months ago

@umberto-sonnino Our local QA was able to reproduce on the Firebase Test Lab using a Galaxy A10 (may be faster to start debugging this than obtaining the device). Attached is the full crash trace (I pasted the first few traces below for quick reference).

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 -1492910400. It must be between 0 and 2
11-28 11:38:19.695: F/mudflap.stagin(19552): java_vm_ext.cc:570]   at app.rive.runtime.kotlin.core.RendererType app.rive.runtime.kotlin.core.RendererType$Companion.fromIndex(int) (SourceFile:12)
11-28 11:38:19.695: F/mudflap.stagin(19552): java_vm_ext.cc:570]   at void app.rive.runtime.kotlin.core.FileAsset.<init>(long, int) (SourceFile:4)
11-28 11:38:19.695: F/mudflap.stagin(19552): java_vm_ext.cc:570]   at long app.rive.runtime.kotlin.core.File.import(byte[], int, int, long) (SourceFile:-2)
11-28 11:38:19.695: F/mudflap.stagin(19552): java_vm_ext.cc:570]   at void app.rive.runtime.kotlin.core.File.<init>(byte[], app.rive.runtime.kotlin.core.RendererType, app.rive.runtime.kotlin.core.FileAssetLoader) (SourceFile:30)
11-28 11:38:19.695: F/mudflap.stagin(19552): java_vm_ext.cc:570]   at void app.rive.runtime.kotlin.RiveAnimationView.loadFileFromResource(kotlin.jvm.functions.Function1) (SourceFile:403)
11-28 11:38:19.695: F/mudflap.stagin(19552): java_vm_ext.cc:570]   at void app.rive.runtime.kotlin.RiveAnimationView.<init>(android.content.Context, android.util.AttributeSet) (SourceFile:340)
11-28 11:38:19.695: F/mudflap.stagin(19552): java_vm_ext.cc:570]   at java.lang.Object java.lang.reflect.Constructor.newInstance0(jav
a.lang.Object[]) (Constructor.java:-2)

GalaxyA10RiveCrash.txt

umberto-sonnino commented 7 months ago

@umberto-sonnino Our local QA was able to reproduce on the Firebase Test Lab using a Galaxy A10 (may be faster to start debugging this than obtaining the device). Attached is the full crash trace (I pasted the first few traces below for quick reference).

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 -1492910400. It must be between 0 and 2
11-28 11:38:19.695: F/mudflap.stagin(19552): java_vm_ext.cc:570]   at app.rive.runtime.kotlin.core.RendererType app.rive.runtime.kotlin.core.RendererType$Companion.fromIndex(int) (SourceFile:12)
11-28 11:38:19.695: F/mudflap.stagin(19552): java_vm_ext.cc:570]   at void app.rive.runtime.kotlin.core.FileAsset.<init>(long, int) (SourceFile:4)
11-28 11:38:19.695: F/mudflap.stagin(19552): java_vm_ext.cc:570]   at long app.rive.runtime.kotlin.core.File.import(byte[], int, int, long) (SourceFile:-2)
11-28 11:38:19.695: F/mudflap.stagin(19552): java_vm_ext.cc:570]   at void app.rive.runtime.kotlin.core.File.<init>(byte[], app.rive.runtime.kotlin.core.RendererType, app.rive.runtime.kotlin.core.FileAssetLoader) (SourceFile:30)
11-28 11:38:19.695: F/mudflap.stagin(19552): java_vm_ext.cc:570]   at void app.rive.runtime.kotlin.RiveAnimationView.loadFileFromResource(kotlin.jvm.functions.Function1) (SourceFile:403)
11-28 11:38:19.695: F/mudflap.stagin(19552): java_vm_ext.cc:570]   at void app.rive.runtime.kotlin.RiveAnimationView.<init>(android.content.Context, android.util.AttributeSet) (SourceFile:340)
11-28 11:38:19.695: F/mudflap.stagin(19552): java_vm_ext.cc:570]   at java.lang.Object java.lang.reflect.Constructor.newInstance0(jav
a.lang.Object[]) (Constructor.java:-2)

GalaxyA10RiveCrash.txt

@jt-gilkeson Thanks for sharing these! Is this happening on an empty Activity with the RiveAnimationView from above? Do you have a sample project that you could also share?

ToddAtMudflap commented 7 months ago

@umberto-sonnino I'm QA on the team here. I dug a little deeper into the crash and it appears to be related to the specific animation truck_stop_loader.riv which JT provided in the ZIP file in the issue description. I loaded that specific animation into a test project and it crashes on launch when run on specific devices that were mentioned above. If need be, I can share the test project and instrumentation test if you'd like to build and deploy the app / test in Test Lab to verify.

jt-gilkeson commented 7 months ago

Note that this animation was converted from Lottie using the Rive editor.

umberto-sonnino commented 7 months ago

Hi @jt-gilkeson & @ToddAtMudflap we finally got our hands on one of those devices and the problem cleanly reproduced there! We posted a fix on 9.0.10, let us know if this fixes the crash for you too!

ToddAtMudflap commented 7 months ago

Thanks @umberto-sonnino! Updated Rive to 9.0.10 and tried in my test harness and the test passed on Test Lab. Will try in our app on a future release but things look to be fixed with the update. Thanks again!

umberto-sonnino commented 6 months ago

I'm going to close this for now, it sounds like it's now resolved! Feel free to reopen if this pops up again!