Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App is being crashed instantly after build : java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libturbomodulejsijni.so #35264

Closed
NavidAsadi opened this issue Nov 8, 2022 · 12 comments

Comments

@NavidAsadi
Copy link

NavidAsadi commented Nov 8, 2022

I was using RN V0.63.3 until this build failures happenings.
I change my version to 0.63.5 and build done successfully. Now my application is being crashed instantly after build in development mode.

I upgraded my gradle version from 3.5.2 to 3.5.3 and tried these fixes :

  1. I used this code in \Android\build.gradle :
configurations.all {
        resolutionStrategy {
            force "com.facebook.react:react-native:0.63.5" 
        }
    }
  1. Add below code in \Android\build.gridle :
project.ext.react = [
    enableHermes: false,  // clean and rebuild if changing
 +   _deleteDebugFilesForVariant: { false }_
]
  1. many other fixes that could not help...

my project configurations :

buildscript {
    ext {
        buildToolsVersion = "29.0.2"
        minSdkVersion = 21
        compileSdkVersion = 29
        targetSdkVersion = 29
    }
    repositories {
        google()
        mavenCentral()
        jcenter()
        maven { url "https://maven.fabric.io/public" }
    }
    dependencies {
        classpath("com.android.tools.build:gradle:3.5.3")
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        if (useIntlJsc) {
            implementation "org.webkit:android-jsc-intl:+"
        } else {
            implementation "org.webkit:android-jsc:+"
        }
    }
}

allprojects {
    configurations.all {
        resolutionStrategy {
            force "com.facebook.react:react-native:0.63.5" 
        }
    }
    repositories {
        google()
        jcenter()
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }
        maven { url "https://s3.amazonaws.com/repo.commonsware.com" }
        maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
        maven { url "https://www.jitpack.io" }
        maven { url "https://maven.google.com" }        
        google()
        maven { url "https://www.jitpack.io" }
    }
    // Workaround for https://issuetracker.google.com/117900475
    // Remove when upgrading to AGP 3.4 or higher.
    configurations.matching { it.name == "_internal_aapt2_binary" }.all { config ->
        config.resolutionStrategy.eachDependency { details ->
            details.useVersion("3.5.0-alpha03-5252756")
        }
    }
}

Error log :

java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libturbomodulejsijni.so
 SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/user/0/com.zcarpet/lib-main flags = 1]
 SoSource 1: com.facebook.soloader.DirectorySoSource[root = /data/app/~~KMJLGB_dK8wOpeDofL08yw==/com.zcarpet-MslZO0JpUFbInWyE8VCwcA==/lib/arm64 flags = 0]
 SoSource 2: com.facebook.soloader.DirectorySoSource[root = /vendor/lib64 flags = 2]
 SoSource 3: com.facebook.soloader.DirectorySoSource[root = /system/lib64 flags = 2]
 Native lib dir: /data/app/~~KMJLGB_dK8wOpeDofL08yw==/com.zcarpet-MslZO0JpUFbInWyE8VCwcA==/lib/arm64
 result: 0
 at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:896)
 at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:725)
 at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:649)
 at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:629)
 at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:577)
 at com.facebook.react.turbomodule.core.CallInvokerHolderImpl.maybeLoadSoLibrary(CallInvokerHolderImpl.java:32)
 at com.facebook.react.turbomodule.core.CallInvokerHolderImpl.<init>(CallInvokerHolderImpl.java:25)
 at com.facebook.react.bridge.CatalystInstanceImpl.getJSCallInvokerHolder(Native Method)
 at com.facebook.react.bridge.CatalystInstanceImpl.getJSCallInvokerHolder(CatalystInstanceImpl.java:46)
 at io.realm.react.RealmReactModule.initialize(RealmReactModule.java:91)
 at com.facebook.react.bridge.ModuleHolder.doInitialize(ModuleHolder.java:236)
 at com.facebook.react.bridge.ModuleHolder.markInitializable(ModuleHolder.java:100)
 at com.facebook.react.bridge.NativeModuleRegistry.notifyJSInstanceInitialized(NativeModuleRegistry.java:103)
 at com.facebook.react.bridge.CatalystInstanceImpl$4.run(CatalystInstanceImpl.java:541)
 at android.os.Handler.handleCallback(Handler.java:938)
 at android.os.Handler.dispatchMessage(Handler.java:99)
 at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
 at android.os.Looper.loopOnce(Looper.java:210)
 at android.os.Looper.loop(Looper.java:299)
 at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:226)
 at java.lang.Thread.run(Thread.java:1012)

so, could you help me to fix the problem?

Originally posted by @NavidAsadi in #35210 (comment)

@NavidAsadi NavidAsadi changed the title I was using RN V0.63.3 until this build failures happenings. App is being crashed instantly after build : java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libturbomodulejsijni.so Nov 8, 2022
@TarunBardawa
Copy link

facing same issue +1

@cortinico
Copy link
Contributor

I suspect this was related to #35210
I'm closing as a duplicate. If the issue persists -> Please re-open

@ankitk-nimblechapps
Copy link

ankitk-nimblechapps commented Apr 13, 2023

the issue is still exist, i am using react native version is 0.63.2 i tried to update to 0.63.5 as suggest to
#35210 but still getting the same error.
Screenshot 2023-04-13 at 2 36 06 PM

Please Help

@agam-colaburate
Copy link

+1 it still exist, any fix ?

@amirhosein5858
Copy link

i know it's weird but this error gone when i turn debug with chrome on !!!!!

@bimodwilaksono
Copy link

i know it's weird but this error gone when i turn debug with chrome on !!!!!

Thanks anyway, it works

@Linuhusainnk
Copy link

the issue is still exist, i am using react native version is 0.63.2 i tried to update to 0.63.5 as suggest to #35210 but still getting the same error. Screenshot 2023-04-13 at 2 36 06 PM

Please Help

any solution ?

@professionally
Copy link

the issue is still exist, i am using react native version is 0.63.2 i tried to update to 0.63.5 as suggest to #35210 but still getting the same error. Screenshot 2023-04-13 at 2 36 06 PM
Please Help

any solution ?

Facing the same issue with RN 0.63.5.
Applied the patch and tried everything, I could find... Hermes is disabled.
I tried to remove all node_modules and reinstalled, cleaning gradle cache, removing build folders..

Here's what I tried:
android/build.gradle


// Top-level build file where you can add configuration options common to all sub-projects/modules.
def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())

... 
allprojects {
    configurations.all {
        resolutionStrategy {
            force 'com.facebook.react:react-native:' + REACT_NATIVE_VERSION
        }
    }

    repositories {
       
        mavenCentral()
        mavenLocal()
        // maven {
        //     // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
        //     url("$rootDir/../node_modules/react-native/android")
        // }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }
        google()
        maven { url 'https://maven.google.com' }
        maven { url 'https://www.jitpack.io' }
        exclusiveContent {
           filter {
               includeGroup "com.facebook.react"
           }
           forRepository {
               maven {
                   url "$rootDir/../node_modules/react-native/android"
               }
           }
        }
        jcenter()
    }

app/build.gradle

   defaultConfig {
...
}
 packagingOptions {
        pickFirst '**/libjsc.so'
        pickFirst '**/libc++_shared.so'
        pickFirst '**/llibturbomodulejsijni.so'
        pickFirst '**/libturbomodulejsijni.so'
    }

gradle.properties

android.enableJetifier=true
android.bundle.enableUncompressedNativeLibs=false

Please help... Build succesfull, app crashes with exact the same error after opening at on my android device.
IOS simulator working fine.

@professionally
Copy link

professionally commented Nov 18, 2023

In app/build.gradle I changed following line:
implementation 'com.facebook.soloader:soloader:0.10.1'

to following line:
implementation 'com.facebook.soloader:soloader:0.10.5+'

Now the issue is still there but it's called different:

Error: Exception in HostFunction: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.friendshipper-76N7YqpagKtwaFXf7e95Bw==/base.apk"],nativeLibraryDirectories=[/data/app/com.friendshipper-76N7YqpagKtwaFXf7e95Bw==/lib/arm64, /data/app/com.friendshipper-76N7YqpagKtwaFXf7e95Bw==/base.apk!/lib/arm64-v8a, /system/lib64, /hw_product/lib64, /system/product/lib64, /prets/lib64]]] couldn't find "libturbomodulejsijni.so"
[Sat Nov 18 2023 22:15:59.920]  ERROR    Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)
[Sat Nov 18 2023 22:15:59.920]  ERROR    Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)

The weird thing is, when I activate debugging via chrome, it works - but unfortunately the app itself has lots of bugs then, so it isn't really usefull.

@professionally
Copy link

I finally fixed the issue by upgrading my react native version from 0.63.5 to 0.64.4.

@ErMapsh
Copy link

ErMapsh commented Feb 15, 2024

i know it's weird but this error gone when i turn debug with chrome on !!!!!

yes it also worked for me, but when i stop debugging error comes again

@chreuseun
Copy link

chreuseun commented Jun 26, 2024

In terms of using / a project have a setup of :

"react-native": "^0.66.5"
"react-native-mmkv": "^2.5.1" >> This is the latest version can be used for React-Native >=0.70
image


How did I fixed
I am using the latest Android Studio Hegdehog
image

For the fix:

  1. Use openJDK version 11. Set $JAVA_HOME=<path of JDK 11> , re-open the terminal type java --version
image
  1. Use Node 16.1x.xx image

  2. Ensure the NDK is installed in Android Studio , for me I need 21.4.7075529

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests