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

Description

I am getting this error when I build a new app from scratch with react native 0.73.3 and react-native-reanimated 3.6.2

Error: Exception in HostFunction: java.lang.UnsatisfiedLinkError: dlopen failed: library "libreanimated.so" not found, js engine: hermes 
    at App (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.animtest&modulesOnly=false&runModule=true:125577:54)
    at RCTView
    at View (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.animtest&modulesOnly=false&runModule=true:60116:43)
    at RCTView
    at View (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.animtest&modulesOnly=false&runModule=true:60116:43)
    at AppContainer (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.animtest&modulesOnly=false&runModule=true:59958:36)
    at AnimTest(RootComponent) (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.animtest&modulesOnly=false&runModule=true:111059:28)
 ERROR  Error: Exception in HostFunction: java.lang.UnsatisfiedLinkError: dlopen failed: library "libreanimated.so" not found, js engine: hermes 
    at App (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.animtest&modulesOnly=false&runModule=true:125577:54)
    at RCTView
    at View (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.animtest&modulesOnly=false&runModule=true:60116:43)
    at RCTView
    at View (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.animtest&modulesOnly=false&runModule=true:60116:43)
    at AppContainer (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.animtest&modulesOnly=false&runModule=true:59958:36)
    at AnimTest(RootComponent) (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.animtest&modulesOnly=false&runModule=true:111059:28)
 ERROR  TypeError: Cannot read property 'makeMutable' of undefined

This error is located at:
    in App
    in RCTView (created by View)
    in View (created by AppContainer)
    in RCTView (created by View)
    in View (created by AppContainer)
    in AppContainer
    in AnimTest(RootComponent), js engine: hermes
 ERROR  TypeError: Cannot read property 'makeMutable' of undefined

This error is located at:
    in App
    in RCTView (created by View)
    in View (created by AppContainer)
    in RCTView (created by View)
    in View (created by AppContainer)
    in AppContainer
    in AnimTest(RootComponent), js engine: hermes

Steps to reproduce

  1. Create a new project with npx react-native@latest init AwesomeProject
  2. Install react-native-reanimated by following the steps in https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started
  3. Create a basic animation with https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/your-first-animation
  4. Connect an android device via ADB.
  5. Run the debug build on android, by npm start and pressing a

https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/your-first-animation

Snack or a link to a repository

https://github.com/SounakB/reanimated-build-error

Reanimated version

^3.6.2

React Native version

0.73.3

Platforms

Android

JavaScript runtime

Hermes

Workflow

React Native

Architecture

Paper (Old Architecture)

Build type

Debug app & dev bundle

Device

Real device

Device model

Vivo Y22 (Android 13)

Acknowledgements

Yes

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 6
  • Comments: 16 (1 by maintainers)

Most upvoted comments

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

Here is solution that worked for me

// android/build.gradle
buildscript {
    ext {
        buildToolsVersion = "34.0.0"
        minSdkVersion = 21
        compileSdkVersion = 34
        targetSdkVersion = 34
      -- ndkVersion = "25.1.8937393"
      ++ ndkVersion = "23.1.7779620"
        kotlinVersion = "1.8.0"
    }

Before adopting this I tested a lot of possibilities, even tested the example app from reanimated it self and the issue was still present. I will adopt this as a temporary solution until they properly upgrade the SDK to work with react-native 0.73 which uses ndk 25.

I’ve seen this PR early this #5587 morning that went in. But does not seem to fix the issue.

React Native 0.73 viene por defecto con ndk = 25.1.8937393. Para solucionarlo, tuve que colocar el NDK en 23.1.7779620.

Aquí está la solución que funcionó para mí.

// android/build.gradle
buildscript {
    ext {
        buildToolsVersion = "34.0.0"
        minSdkVersion = 21
        compileSdkVersion = 34
        targetSdkVersion = 34
      -- ndkVersion = "25.1.8937393"
      ++ ndkVersion = "23.1.7779620"
        kotlinVersion = "1.8.0"
    }

Antes de adoptar esto, probé muchas posibilidades, incluso probé la aplicación de ejemplo reanimada y el problema seguía presente. Adoptaré esto como una solución temporal hasta que actualicen adecuadamente el SDK para que funcione con reaccionar-nativo 0.73 que usa ndk 25.

Vi este PR temprano esta mañana # 5587 que entró. Pero no parece solucionar el problema.

muchas gracias compa, estuve alrededor de 3 dias tratando de solucionar este problema con google, IA, Stackoverflow, cantidades de informacion y trate de todo y nada me funcionaba hasta que lei tu solucion, Gracias por tu aporte

facing the same issue during the react-native upgrade from 0.67.3 to 0.74.0


// android/build.gradle
buildscript {

    ext {
        buildToolsVersion = "34.0.0"
        minSdkVersion = 23
        compileSdkVersion = 34
        targetSdkVersion = 34
        ndkVersion = "26.1.10909125"
        supportLibVersion = "28.0.0"         
        googlePlayServicesVersion = "17.0.0"
        androidMapsUtilsVersion = "2.3.0" 
        kotlinVersion = "1.9.22"

    }
   }
  

Had the same issue on RN 72. Updated react-native-reanimated to 3.15 (last compatible with my react-native version) and the issue is gone. As written in reanimated docs there’s no breaking changes between version 2 and 3, so could be painless. Also during update make sure to remove some old reanimated configurations if present. Like import com.swmansion.reanimated.ReanimatedJSIModulePackage; etc…