realm-kotlin: UnsatisfiedLinkError: couldn't find "librealmc.so"

SDK: realm-kotlin

Version: ‘io.realm.kotlin:library-sync:1.5.0’, ‘io.realm.kotlin:gradle-plugin:1.5.0’

Observations

  • How frequent do the crash occur? Subset of users

  • Does it happen in production or during dev/test? Production

  • Can the crash be reproduced by you? No. I was unable to reproduce in the Android Emulator on Nexus 7 - Android 8.1

  • Can you provide instructions for how we can reproduce it? Seems to be occuring on app launch when calling App.create()

From Firebase Crashlytics:

Nexus 5X - Android 8.1.0

Fatal Exception: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.crystalyze.crystalyze-mp0dbfOJe8A8n38Sjr4jkw==/base.apk"],nativeLibraryDirectories=[/data/app/com.crystalyze.crystalyze-mp0dbfOJe8A8n38Sjr4jkw==/lib/x86, /system/lib, /vendor/lib]]] couldn't find "librealmc.so"
       at java.lang.Runtime.loadLibrary0(Runtime.java:1011)
       at java.lang.System.loadLibrary(System.java:1657)
       at io.realm.kotlin.internal.interop.realmc.<clinit>(realmc.java:16)
       at io.realm.kotlin.internal.interop.RealmInterop.realm_network_transport_new(RealmInterop.java:49)
       at io.realm.kotlin.mongodb.internal.AppConfigurationImpl.initializeRealmAppConfig(AppConfigurationImpl.java:49)
       at io.realm.kotlin.mongodb.internal.AppConfigurationImpl.<init>(AppConfigurationImpl.java:49)
       at io.realm.kotlin.mongodb.AppConfiguration$Builder.build(AppConfiguration.java:68)
       at io.realm.kotlin.mongodb.App$Companion.create(App.java:68)

Galaxy Tab A - Android 7.1.2

Fatal Exception: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.crystalyze.crystalyze-1/base.apk"],nativeLibraryDirectories=[/data/app/com.crystalyze.crystalyze-1/lib/x86_64, /system/lib64, /vendor/lib64]]] couldn't find "librealmc.so"
       at java.lang.Runtime.loadLibrary0(Runtime.java:1001)
       at java.lang.System.loadLibrary(System.java:1562)
       at io.realm.kotlin.internal.interop.realmc.<clinit>(realmc.java)
       at io.realm.kotlin.internal.interop.RealmInterop.realm_network_transport_new(RealmInterop.java:49)
       at io.realm.kotlin.mongodb.internal.AppConfigurationImpl.initializeRealmAppConfig(AppConfigurationImpl.java:49)
       at io.realm.kotlin.mongodb.internal.AppConfigurationImpl.<init>(AppConfigurationImpl.java:49)
       at io.realm.kotlin.mongodb.AppConfiguration$Builder.build(AppConfiguration.java:68)
       at io.realm.kotlin.mongodb.App$Companion.create(App.java:68)

In the APK, librealmc.so exists in /lib/x86_64 /lib/x86 /lib/arm64-v8a /lib/armeabi-v7a

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 1
  • Comments: 17 (4 by maintainers)

Most upvoted comments

The problem with this error is that we think this is related to the Playstore distribution and App Bundles and sometimes the app store sends the wrong thing to devices. Unfortunately, this is basically impossible to test and we have never been able to reproduce it.

At the same time, we have seen people manually distributing the wrong app bundles to devices, but this normally happens with custom app distribution frameworks or rooted devices where you try to sideload an APK.

That said, we just pushed a change that is available in 1.10-SNAPSHOT which disables Relinker above API 22. The reason we use Relinker is that Android has known bugs loading native code on API 22 and below, but there is no need to use it above.

So just to be 100% sure this library is not involved in these bugs, it has now been disabled.

Apart from that, the solution we have seen working is to disable App Bundles, unfortunately, the tradeoff there is an increase in APK size.