Mayur Gajra
Mayur Gajra

Reputation: 9083

java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libfbjni.so result: 0

I created a new react-native project and added my android native module as a dependency.using official doc https://reactnative.dev/docs/native-modules-setup

When I run this I get the error with following stack trace:

java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libfbjni.so result: 0
        at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:825)
        at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:673)
        at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:611)
        at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:559)
        at com.facebook.soloader.NativeLoaderToSoLoaderDelegate.loadLibrary(NativeLoaderToSoLoaderDelegate.java:25)
        at com.facebook.soloader.nativeloader.NativeLoader.loadLibrary(NativeLoader.java:44)
        at com.facebook.jni.HybridData.<clinit>(HybridData.java:34)
        at com.facebook.flipper.android.FlipperThread.run(FlipperThread.java:25) 

Following is my package.json

{
  "name": "albums",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "axios": "^0.19.2",
    "react": "16.11.0",
    "react-native": "0.62.0-rc.5",
    "react-native-my-fancy-library": "../react-native-my-fancy-library/"
  },
  "devDependencies": {
    "@babel/core": "^7.9.0",
    "@babel/runtime": "^7.9.2",
    "@react-native-community/eslint-config": "^1.0.0",
    "babel-jest": "^25.3.0",
    "eslint": "^6.8.0",
    "jest": "^25.3.0",
    "metro-react-native-babel-preset": "^0.59.0",
    "react-test-renderer": "16.11.0"
  },
  "jest": {
    "preset": "react-native"
  }
}

I have already tried:

https://stackoverflow.com/a/61695629/9715339

https://stackoverflow.com/a/57155606/9715339

https://github.com/facebook/react-native/issues/25415

But none of these solved my issue.

I am a beginner in react-native. So I don't know what other details files I need to post here. Do let me know if you need any other files.

Upvotes: 18

Views: 17070

Answers (4)

salil sahu
salil sahu

Reputation: 1

Added the below line in android/app/build file worked for me.packagingOptions {jniLibs {useLegacyPackaging = true}}

Upvotes: 0

Usama Nasir
Usama Nasir

Reputation: 134

for me this is resolved after following below steps 3 steps

  1. Up minSdk to 23
  2. In gradle.properties add line: android.bundle.enableUncompressedNativeLibs=false;
  3. In your manifest file add line: android:extractNativeLibs=true;

Upvotes: 3

Patrick Barbosa
Patrick Barbosa

Reputation: 21

I had the same problem that I solved by updating build.gradle 3.5.2 to 3.5.3 by Android Strudio.

enter image description here

The image shows the update of the classpath in the dependencies in the build.gradle file in the android folder

Upvotes: 2

MikeL
MikeL

Reputation: 2904

For me the following two solved it (I think it was the latter that did it):

  1. Reset cache: react-native start --reset-cache
  2. Clean Android: cd android -> ./gradlew clean

Upvotes: 47

Related Questions