react-native-reanimated icon indicating copy to clipboard operation
react-native-reanimated copied to clipboard

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

Open SounakB opened this issue 5 months ago • 8 comments

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

SounakB avatar Feb 01 '24 14:02 SounakB

Hi! Does your app work in simulator? Also you run it without Android Studio, do you?

Latropos avatar Feb 01 '24 16:02 Latropos

I have the same issue with his setup. It does not work on a simulator. Help here is needed even if it's a patch.

gilons avatar Feb 05 '24 06:02 gilons

Hi! Does your app work in simulator? Also you run it without Android Studio, do you?

@Latropos The app works on the simulator without any error, I have the android studio installed but I run it from terminal with npm start then press a for android as shown in the menu.

SounakB avatar Feb 05 '24 07:02 SounakB

Currently I have downgraded to react-native 0.71.14 and react-native-reanimated 3.5.4 to avoid this problem

SounakB avatar Feb 05 '24 08:02 SounakB

I will test downgrading gradle plugin to see if it fixes the problem

gilons avatar Feb 05 '24 08:02 gilons

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.

gilons avatar Feb 05 '24 13:02 gilons

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

Jesus-piedrahita96 avatar Mar 11 '24 01:03 Jesus-piedrahita96

We are seeing this issue in our crashlytics on all OnePlus8Pro devices. We are using version 2.14.4. Any other device works ok. Any idea?

scblason avatar Apr 06 '24 06:04 scblason