Rive MalformedFileException

Open
#327 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
android, kotlin, react-native, typescript
Domain
mobile

Research direction

Start by reproducing the crash with the provided remote .riv URL and inspect File.kt:30, RiveAnimationView.kt:385, and RiveAnimationView.loadFileFromResource from the stack trace. Compare remote loading with a local asset and determine why the remote file reaches MalformedFileException; done means the remote animation no longer crashes and the reported load failure is handled.

Written by the indexing model from the issue text.

Description

triage
### 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.

Dominant language
TypeScript
Stars
783
Forks
81
Avg merge
3d 6h
Merged PRs (30d)
3

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rive-app/rive-react-native

All issues in rive-app/rive-react-native

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.