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

java.lang.UnsatisfiedLinkError: couldn't find DSO to load: librealm.so #5521

Closed
somasekharkakarla opened this issue Mar 2, 2023 · 9 comments

Comments

@somasekharkakarla
Copy link

somasekharkakarla commented Mar 2, 2023

How frequently does the bug occur?

Always

Description

App crashes after updating realm to from 11.0.0 > 11.5.1.

For React Native:

"react": "18.1.0",
"react-native": "0.70.5",
"realm": "11.5.1",

For Android:

    buildToolsVersion = "32.0.0"
    minSdkVersion = 26
    compileSdkVersion = 33
    targetSdkVersion = 33
    kotlinVersion = '1.5.0'
    if (System.properties['os.arch'] == "aarch64") {
        // For M1 Users we need to use the NDK 24 which added support for aarch64
        ndkVersion = "24.0.8215888"
    } else {
        // Otherwise we default to the side-by-side NDK version from AGP.
        ndkVersion = "21.4.7075529"
    }

Stacktrace & log output

couldn't find DSO to load: librealm.so
                                                                                                    	SoSource 0: com.facebook.soloader.DirectorySoSource[root = /data/app/~~geNXm8FMVe-jDNmD9sy6ow==/com.sensehawk.sensehawknative-2Re9_gDQLT1N-G7r0qF3Cg==/lib/arm64 flags = 0]
                                                                                                    	SoSource 1: com.facebook.soloader.DirectApkSoSource[root = (/data/app/~~geNXm8FMVe-jDNmD9sy6ow==/com.sensehawk.sensehawknative-2Re9_gDQLT1N-G7r0qF3Cg==/base.apk!/lib/arm64-v8a, )]
                                                                                                    	SoSource 2: com.facebook.soloader.DirectorySoSource[root = /system/lib64 flags = 2]
                                                                                                    	SoSource 3: com.facebook.soloader.DirectorySoSource[root = /vendor/lib64 flags = 2]
                                                                                                    	Native lib dir: /data/app/~~geNXm8FMVe-jDNmD9sy6ow==/com.sensehawk.sensehawknative-2Re9_gDQLT1N-G7r0qF3Cg==/lib/arm64
                                                                                                     result: 0

=============================================

Failed to create NativeModule "Realm"
                                                                                                    java.lang.UnsatisfiedLinkError: couldn't find DSO to load: librealm.so
                                                                                                    	SoSource 0: com.facebook.soloader.DirectorySoSource[root = /data/app/~~geNXm8FMVe-jDNmD9sy6ow==/com.sensehawk.sensehawknative-2Re9_gDQLT1N-G7r0qF3Cg==/lib/arm64 flags = 0]
                                                                                                    	SoSource 1: com.facebook.soloader.DirectApkSoSource[root = (/data/app/~~geNXm8FMVe-jDNmD9sy6ow==/com.sensehawk.sensehawknative-2Re9_gDQLT1N-G7r0qF3Cg==/base.apk!/lib/arm64-v8a, )]
                                                                                                    	SoSource 2: com.facebook.soloader.DirectorySoSource[root = /system/lib64 flags = 2]
                                                                                                    	SoSource 3: com.facebook.soloader.DirectorySoSource[root = /vendor/lib64 flags = 2]
                                                                                                    	Native lib dir: /data/app/~~geNXm8FMVe-jDNmD9sy6ow==/com.sensehawk.sensehawknative-2Re9_gDQLT1N-G7r0qF3Cg==/lib/arm64
                                                                                                     result: 0
                                                                                                    	at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:1127)
                                                                                                    	at com.facebook.soloader.SoLoader.loadLibraryBySoNameImpl(SoLoader.java:943)
                                                                                                    	at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:855)
                                                                                                    	at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:802)
                                                                                                    	at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:772)
                                                                                                    	at io.realm.react.RealmReactModule.<clinit>(RealmReactModule.java:57)
                                                                                                    	at io.realm.react.RealmReactPackage.getModule(RealmReactPackage.java:35)
                                                                                                    	at com.facebook.react.TurboReactPackage$ModuleHolderProvider.get(TurboReactPackage.java:159)
                                                                                                    	at com.facebook.react.TurboReactPackage$ModuleHolderProvider.get(TurboReactPackage.java:147)
                                                                                                    	at com.facebook.react.bridge.ModuleHolder.create(ModuleHolder.java:191)
                                                                                                    	at com.facebook.react.bridge.ModuleHolder.getModule(ModuleHolder.java:156)
                                                                                                    	at com.facebook.react.bridge.JavaModuleWrapper.findMethods(JavaModuleWrapper.java:71)
                                                                                                    	at com.facebook.react.bridge.JavaModuleWrapper.getMethodDescriptors(JavaModuleWrapper.java:111)
                                                                                                    	at com.facebook.jni.NativeRunnable.run(Native Method)
                                                                                                    	at android.os.Handler.handleCallback(Handler.java:942)
                                                                                                    	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:201)
                                                                                                    	at android.os.Looper.loop(Looper.java:288)
                                                                                                    	at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:228)

====================================================

Error: Exception in HostObject::get for prop 'Realm': java.lang.UnsatisfiedLinkError: couldn't find DSO to load: librealm.so
                                                                                                    	SoSource 0: com.facebook.soloader.DirectorySoSource[root = /data/app/~~geNXm8FMVe-jDNmD9sy6ow==/com.sensehawk.sensehawknative-2Re9_gDQLT1N-G7r0qF3Cg==/lib/arm64 flags = 0]
                                                                                                    	SoSource 1: com.facebook.soloader.DirectApkSoSource[root = (/data/app/~~geNXm8FMVe-jDNmD9sy6ow==/com.sensehawk.sensehawknative-2Re9_gDQLT1N-G7r0qF3Cg==/base.apk!/lib/arm64-v8a, )]
                                                                                                    	SoSource 2: com.facebook.soloader.DirectorySoSource[root = /system/lib64 flags = 2]
                                                                                                    	SoSource 3: com.facebook.soloader.DirectorySoSource[root = /vendor/lib64 flags = 2]
                                                                                                    	Native lib dir: /data/app/~~geNXm8FMVe-jDNmD9sy6ow==/com.sensehawk.sensehawknative-2Re9_gDQLT1N-G7r0qF3Cg==/lib/arm64
                                                                                                     result: 0, js engine: hermes

Can you reproduce the bug?

Always

Reproduction Steps

just update from 11.0.0 > 11.5.1

Version

11.5.1

What services are you using?

Local Database only

Are you using encryption?

No

Platform OS and version(s)

android 13

Build environment

Which debugger for React Native: ..

Cocoapods version

No response

@kneth
Copy link
Contributor

kneth commented Mar 3, 2023

@somasekharkakarla The error message is a bit odd but in order to use v11.5.1, you will have to update React Native.

Please check the compatibility matrix

@sync-by-unito sync-by-unito bot added the Waiting-For-Reporter Waiting for more information from the reporter before we can proceed label Mar 3, 2023
@somasekharkakarla
Copy link
Author

Thank you. Please correct this.
Screenshot_20230303-192036

@github-actions github-actions bot added Needs-Attention Reporter has responded. Review comment. and removed Waiting-For-Reporter Waiting for more information from the reporter before we can proceed labels Mar 3, 2023
@kneth
Copy link
Contributor

kneth commented Mar 9, 2023

Thanks for pointing out that our CHANGELOG.md is inaccurate. We'll fix it.

@sync-by-unito sync-by-unito bot removed the Needs-Attention Reporter has responded. Review comment. label Mar 9, 2023
@sync-by-unito sync-by-unito bot closed this as completed Mar 9, 2023
@shridhar48
Copy link

Hi @kneth
I am using below versions of react native and realm

"react-native": "0.68.5",
"realm":"11.0.0-rc.0"

Also I am using ndk version 23.0.7599858

I have referred this link to pick the above realm version.

I am able to generate a signed apk build on Android but immediately on app launch I am getting the same error

Error: Exception in HostObject::get for prop 'Realm': java.lang.UnsatisfiedLinkError: couldn't find DSO to load: librealm.so caused by: io.realm.react.util.SSLHelper result: 0, js engine:

Anything we can do to resolve this issue?

@vijaydokrimare-gep
Copy link

vijaydokrimare-gep commented Jul 21, 2023

Hello @shridhar48 ,

Try adding
-keep class io.realm. { ; }*
in android/app/proguard-rules.pro. It should work.

@nabilashraf
Copy link

nabilashraf commented Jul 31, 2023

Hi I'm facing the same issue, here are my configurations:

I am using:

realm: 11.10.1
react-native 0.71.4

`
System:
OS: macOS 13.4.1
CPU: (8) x64 Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
Memory: 632.38 MB / 8.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 16.14.2 - ~/.nvm/versions/node/v16.14.2/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 8.5.0 - ~/.nvm/versions/node/v16.14.2/bin/npm
Watchman: 2022.10.03.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.11.2 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
Android SDK:
API Levels: 28, 29, 30, 31, 33
Build Tools: 28.0.3, 29.0.2, 29.0.3, 30.0.2, 30.0.3, 31.0.0, 32.0.0, 33.0.0
System Images: android-30 | Google APIs Intel x86 Atom
Android NDK: Not Found
IDEs:
Android Studio: 4.1 AI-201.8743.12.41.7042882
Xcode: 14.2/14C18 - /usr/bin/xcodebuild
Languages:
Java: 11.0.11 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.2.0 => 18.2.0
react-native: 0.71.4 => 0.71.4
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

`

Can someone help? 

@shridhar48
Copy link

Hi @nabilashraf , I tried @vijaydokrimare-gep solution by adding following line to proguard-rules.pro file
-keep class io.realm.** { * ; }
And it solved my issue.

@nabilashraf
Copy link

Unfortunately, for me it didn't work. It still crashes the app.

@theprantadutta
Copy link

Hi @nabilashraf , I tried @vijaydokrimare-gep solution by adding following line to proguard-rules.pro file -keep class io.realm.** { * ; } And it solved my issue.

This should be added to the Documentation

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants