Skip to content

Rive MalformedFileException #327

@manishtrivedi994

Description

@manishtrivedi994
### Description

App is crashing in production when trying to render a Rive animation from a remote `.riv` file.

Crash logs point to a native failure after loading the remote Rive URL:
```
https://cdn.jsdelivr.net/gh/shubham-k2/assets@main/Updated%20surprise_sale_banner.riv
```

The crash happens inside this stack trace:
```
Thread Name: app.rive.runtime.kotlin.core.errors.MalformedFileException
  app.rive.runtime.kotlin.core.File.import (Native Method:0)
  app.rive.runtime.kotlin.core.File. (File.kt:30)
  app.rive.runtime.kotlin.RiveAnimationView.loadFileFromResource (RiveAnimationView.kt:385)
  app.rive.runtime.kotlin.RiveAnimationView.onAttachedToWindow (RiveAnimationView.kt:880)
  android.view.View.dispatchAttachedToWindow (View.java:21976)
  android.view.ViewGroup.dispatchAttachedToWindow (ViewGroup.java:4302)
  android.view.ViewGroup.dispatchAttachedToWindow (ViewGroup.java:4302)
  android.view.ViewGroup.dispatchAttachedToWindow (ViewGroup.java:4302)
  android.view.ViewGroup.dispatchAttachedToWindow (ViewGroup.java:4302)
  android.view.ViewGroup.addViewInner (ViewGroup.java:6127)
  android.view.ViewGroup.addView (ViewGroup.java:5903)
  com.facebook.react.views.view.ReactViewGroup.addView (ReactViewGroup.java:543)
  android.view.ViewGroup.addView (ViewGroup.java:5843)
  com.facebook.react.views.view.ReactClippingViewManager.addView (ReactClippingViewManager.java:40)
  com.facebook.react.views.view.ReactClippingViewManager.addView (ReactClippingViewManager.java:20)
  com.facebook.react.uimanager.NativeViewHierarchyManager.manageChildren (NativeViewHierarchyManager.java:533)
  com.swmansion.reanimated.layoutReanimation.ReanimatedNativeHierarchyManager.manageChildren (ReanimatedNativeHierarchyManager.java:409)
  com.facebook.react.uimanager.UIViewOperationQueue$ManageChildrenOperation.execute (UIViewOperationQueue.java:183)
  com.facebook.react.uimanager.UIViewOperationQueue$1.run (UIViewOperationQueue.java:910)
  com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches (UIViewOperationQueue.java:1023)
  com.facebook.react.uimanager.UIViewOperationQueue.-$$Nest$mflushPendingBatches (Unknown Source:0)
  com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded (UIViewOperationQueue.java:1083)
  com.facebook.react.uimanager.GuardedFrameCallback.doFrame (GuardedFrameCallback.java:29)
  com.facebook.react.modules.core.ReactChoreographer$1.doFrame (ReactChoreographer.java:89)
  android.view.Choreographer$CallbackRecord.run (Choreographer.java:1106)
  android.view.Choreographer.doCallbacks (Choreographer.java:866)
  android.view.Choreographer.doFrame (Choreographer.java:792)
  android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:1092)
  android.os.Handler.handleCallback (Handler.java:938)
  android.os.Handler.dispatchMessage (Handler.java:99)
  android.os.Looper.loopOnce (Looper.java:226)
  android.os.Looper.loop (Looper.java:313)
  android.app.ActivityThread.main (ActivityThread.java:8751)
  java.lang.reflect.Method.invoke (Native Method:0)
  com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:571)
  com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1135)
```

We are using `rive-react-native` 9.2.1 with React Native 0.74.7.

### Provide a Repro

Minimal component that crashes in production when `sourceUrl` is remote:

```tsx
 {
    console.error('Rive file load failed');
  }}
  url="https://cdn.jsdelivr.net/gh/shubham-k2/assets@main/Updated%20surprise_sale_banner.riv"
/>
```

This happens **only** with remote `.riv` URLs; local assets load correctly.

#### Source `.riv`/`.rev` file

You can test this with:
[https://cdn.jsdelivr.net/gh/shubham-k2/assets@main/Updated%20surprise_sale_banner.riv]

We can share the `.rev` file privately if needed.

### Expected behavior

Rive animation should load and play from the remote URL without crashing.

#### Screenshots

_No screenshots available since this is a native crash._

### Device & Versions (please complete the following information)

- Device: Android (various production devices)
- OS: Android 10–14
- React Native: 0.74.7
- rive-react-native: 9.2.1

#### Additional context

- App uses Reanimated and other common animation libraries.
- Local `.riv` assets work perfectly.
- Crashes only occur on remote file loading.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions