java.lang.UnsatisfiedLinkError: dlopen failed: library "libreanimated.so" not found React Native Reanimated Issue React Native

2.6k Views Asked by At

Hey folks I am facing a critical issue on project while running the app on Android. I have visited the related question but not found any solution. Error is following.

complete error:  Error: Exception in HostFunction: java.lang.UnsatisfiedLinkError: dlopen failed: library "libreanimated.so" not found
react-native version: 0.67.3
react-native-reanimated: 2.10.0

classpath("com.android.tools.build:gradle:7.0.0")

minSdkVersion = 21
compileSdkVersion = 31
targetSdkVersion = 31

This error is showing when I install the react-native-reanimated package if I remove this package then this error is removed but I need this package because my drawer navigation depend on this pacakge

If anyone face this issue and resolved it completely Please guide me the right direction.

3

There are 3 best solutions below

1
Lalit kumar On

I have been facing this issue since 2 Dec 2022. Please add the following line in your build.gradle (app) in side Android.

packagingOptions 
{   
 pickFirst 'lib/armeabi-v7a/libreanimated.so' <=== this one
}
0
Stathis Ntonas On

Late to the party but I struggled a bit with this error.

Make sure the following:

on app/build.gradle right above this line: apply from: "../../node_modules/react-native/react.gradle" add:

project.ext.react = [
        enableHermes: true,
        bundleInDebug: true <--- make sure this is set to true
]

// also add this to force rebuild reanimated:
project.ext.reanimated = [
        buildFromSource: true
]

0
Calahad On

I had the same issue although with more recent packages.

I found a fix here: https://github.com/software-mansion/react-native-reanimated/issues/5625

React Native 0.73 comes by default with ndk = 25.1.8937393. To fix it, I had to drop the NDK to 23.1.7779620

UPDATE: Using NDK 26 fixes this altogether, probably a better option if upgrading is not too much hassle for you.

Go to Android Studio->Tools->SDK Manager->SDK tools->Install latest version of NDK (v26)

Then run:

rm -rf node_modules
npm install 
npm start -- --reset-cache
'a'