UnsatisfiedLinkError: cannot locate symbol "__cxa_init_primary_exception" on Android with React Native 0.79.2
Description
I'm encountering a native linking error when trying to use react-native-skia (via the react-native-animated-glow package) on Android, everything works just fine on iOS though. The app crashes on launch with an UnsatisfiedLinkError indicating that the symbol __cxa_init_primary_exception cannot be located in librnskia.so.
Error:
Exception in HostFunction: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__cxa_init_primary_exception" referenced by "/data/app/~~CClSDx8Izzsu_ctmvVMOvQ==/com.nk.USANewsUpdates-gC0opkJyMQ2ULN27d7r6nQ==/base.apk!/lib/arm64-v8a/librnskia.so"...
at com.shopify.reactnative.skia.RNSkiaModule.install(RNSkiaModule.java:54)
The error occurs when the Skia object is accessed in the component, resulting in Skia being undefined which then causes a render error: Cannot read property 'Skia' of undefined.
I've tried and verified that:
- The
ANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ONflag is already present innode_modules/@shopify/react-native-skia/android/build.gradle(line 161) - I've performed a complete clean build process multiple times
- I've uninstalled the old app before rebuilding
The issue persists across all attempts.
Additional Context:
- NDK Version: 28.2.13676358
- compileSdkVersion: 35
- targetSdkVersion: 35
- minSdkVersion: 24
- Gradle plugin version: (automatically resolved by RN 0.79.2)
- Build Tools: 35.0.0
- Kotlin version: 2.0.21
React Native Skia Version
2.3.0
React Native Version
0.79.2
Using New Architecture
- [ ] Enabled
Steps to Reproduce
- Create a React Native
0.79.2project with React19.0.0 - Install
@shopify/react-native-skia@^2.3.0 - Install
react-native-animated-glow@^3.0.1(which depends onreact-native-skia) - Try to use any Skia component
- App crashes on launch with the
UnsatisfiedLinkError
Snack, Code Example, Screenshot, or Link to Repository
The following are the crash errors:
https://github.com/Shopify/react-native-skia/issues/3392#issuecomment-3414077681
This will help you
This will help you
I applied said patch in the comment you mention with the NDK version I already have in my android/build.gradle which is 28.2.13676358 using Yarn and made sure I ran yarn install after but I still got the same errors on Android despite seeing the UnifiedSkiaGlow.tsx file being dynamically bundled to both iOS and Android emulators in the Metro bundler
@naderabdalghani if you provide a reproduction, I could take a look
@naderabdalghani Could this be an issue w/ using NDK 28? From what I can tell, even the latest versions of RN are on NDK 27. Is there a specific reason you are using NDK 28?
@naderabdalghani Could this be an issue w/ using NDK 28? From what I can tell, even the latest versions of RN are on NDK 27. Is there a specific reason you are using NDK 28?
Yes, to support 16 KB memory page sizes by default