feat: add RiveRuntime API for Android init failure handling#153
Merged
feat: add RiveRuntime API for Android init failure handling#153
Conversation
7bdc43e to
d76a6b9
Compare
HayesGordon
reviewed
Feb 20, 2026
|
|
||
| } | ||
|
|
||
| // Exclude Rive native libs to emulate a native lib loading failure. |
Move Rive.init() out of ContentProvider into RivePackage with try/catch. Expose RiveRuntime.initialize() and RiveRuntime.getStatus() to JS so apps can detect and recover from native lib loading failures.
… emulation abiFilter restricts ALL native libs which crashes the entire app. Use packagingOptions to exclude only librive-android.so so RN keeps working and Rive.init() fails gracefully.
- Catch Throwable instead of Exception (UnsatisfiedLinkError is not an Exception) - Throw RuntimeException instead of Error (fbjni only propagates Exception messages) - Include exception class name in error for better debugging
Nitro's JNI bridge wraps Kotlin exceptions in jni::JniException which loses the message in the C++ catch-all handler. Instead, manualInitialize() now just sets the error status without throwing, and the JS wrapper reads initError and throws a descriptive JS Error.
d76a6b9 to
d8f28b8
Compare
mfazekas
pushed a commit
that referenced
this pull request
Feb 27, 2026
🤖 I have created a release *beep* *boop* --- ## [0.2.4](v0.2.3...v0.2.4) (2026-02-27) ### Features * add RiveRuntime API for Android init failure handling ([#153](#153)) ([634724e](634724e)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Moves
Rive.init()out ofContentProvider(which crashes before user code can run) intoRivePackage.createViewManagers()with try/catch. ExposesRiveRuntime.initialize()andRiveRuntime.getStatus()to JS so apps can detect and recover from native lib loading failures (ABI mismatch, missing .so, etc).Refs: rive-android#323, rive-android#341
Closes: #151
API
To skip auto-init, set
Rive_RiveRuntimeAndroidSkipSetup=trueingradle.properties.Test plan
Tested with
Rive_RiveRuntimeAndroidExcludeNativeLibs=truein our example. The code showed this: