Skip to content

Fix the ViroARCamera crash on Android and multi-skin GLB animation - #445

Merged
doranteseduardo merged 1 commit into
developfrom
fix/gltf-skins-and-jni-onload
Nov 6, 2026
Merged

doranteseduardo merged 1 commit into
developfrom
fix/gltf-skins-and-jni-onload

Conversation

@doranteseduardo

Copy link
Copy Markdown
Member

Summary

Fixes two bugs from issues: an Android crash when a scene mounts a ViroARCamera (#597 in viro), and GLB characters with several skins on the same joints losing joint rotations (#599 in viro).

Android: JavaVM set in JNI_OnLoad (VROPlatformUtil.cpp)

  • libviro_renderer.so had no JNI_OnLoad. sVM was set only when a renderer or a loader called VROPlatformSetEnv.
  • Under Fabric, React builds VRTCamera's view before the navigator's renderer. Adding its node calls nativeUpdateAtomicUmbrellaBounds, which reaches getJNIEnv with no VM, and the assertion fails with a SIGSEGV.
  • The library is loaded with System.loadLibrary("viro_renderer"), so JNI_OnLoad now sets the VM before anything else runs. VROPlatformSetEnv keeps setting it as before, with the same value.

GLB: shared joints keep every property (VROGLTFLoader.cpp)

  • resampleSkeletalChannelsToCommonGrid runs once per (animation, skin) and writes each joint's merged channel back in place.
  • When a later skin shares those joints, it re-merges the already-merged channel. The if / else if chain copied only the first property it found (translation), so those joints fell back to their rest-pose rotation and scale.
  • Every property of a channel is now copied, which makes the merge idempotent. Re-sampling a merged track onto a later skin's grid is lossless: that grid includes the merged track's times.

Notes

  • The issue reporter suggested an optional per-animation set of already-merged joints. It isn't included here: a later skin with different joints builds a different grid, and skipping shared joints would leave tracks of different lengths in one skin.
  • CHANGELOG and RELEASE_NOTES (3.1.0) updated.

Testing

  • Built with scripts/build.sh (Android AAR, iOS device and simulator). JNI_OnLoad is exported from libviro_renderer.so in arm64-v8a and armeabi-v7a.
  • The rebuilt binaries ship in viro's companion PR.

@doranteseduardo
doranteseduardo merged commit 9a93fa0 into develop Nov 6, 2026
4 checks passed
@doranteseduardo
doranteseduardo deleted the fix/gltf-skins-and-jni-onload branch November 6, 2026 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants