realm-kotlin
realm-kotlin copied to clipboard
Couldn't find "librealmc.so" in the AndroidUtilsKt.loadAndroidNativeLibs
How frequently does the bug occur?
Sometimes
Description
A few users get an exception on the startup due to a Realm initialization issue.
Stacktrace & log output
Caused by java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.moviebase-4RfS6EnT75kRXk7vq6VROg==/base.apk"],nativeLibraryDirectories=[/data/app/com.moviebase-4RfS6EnT75kRXk7vq6VROg==/lib/arm64, /system/lib64, /system/vendor/lib64]]] couldn't find "librealmc.so"
at java.lang.Runtime.loadLibrary0(Runtime.java:1029)
at java.lang.System.loadLibrary(System.java:1673)
at io.realm.kotlin.internal.AndroidUtilsKt.loadAndroidNativeLibs(AndroidUtils.kt:20)
at io.realm.kotlin.internal.RealmInitializer.create(RealmInitializer.kt:42)
at io.realm.kotlin.internal.RealmInitializer.create(RealmInitializer.kt:30)
at androidx.startup.AppInitializer.doInitialize(AppInitializer.java:180)
at androidx.startup.AppInitializer.discoverAndInitialize(AppInitializer.java:238)
at androidx.startup.AppInitializer.discoverAndInitialize(AppInitializer.java:206)
at androidx.startup.InitializationProvider.onCreate(InitializationProvider.java:45)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1919)
Can you reproduce the bug?
No
Reproduction Steps
No response
Version
1.10.1
What Atlas App Services are you using?
-- select --
Are you using encryption?
No
Platform OS and version(s)
Android 7 and 8
Build environment
No response
Are you distributing your app via AppBundle? Are you able to reproduce the crash locally?
Is it just related to Android versions 7 and 8, or there are other versions affected?
Yes, it is distributed via the aab file (bundle) and only for Android 7/8 devices. There are around 10 users within the latest 5 days.
We have received similar reports to this one, we think this issue is related to app bundle distribution and is not related to the Realm library. There are other parties affected by it.
In version 1.10.0 we disabled Relinker on SDK >= 23, in an effort of fixing the issue, but unfortunately from your report looks like it didn't.
The issue might be caused by users moving the app to the SD card, see Google issue, could you check if any of the solutions discussed there fixes the issue? We have unsuccessfully tried to reproduce it at our end.
- setting the gradle property
enableUncompressedNativeLibs=false, or - adding the following to your
build.gradle:
android {
packagingOptions {
jniLibs {
useLegacyPackaging = true
}
}
}
Hi @clementetb, thanks for the suggestions! I will try out the solutions and will come back with an answer.
@chrisnkrueger Any update on this? I am experiencing the same problem.
It seems the issue doesn't happen anymore in the newer realm versions (1.10).
Issue still persists on v1.11.1. Recorded on Android SDK 27 (8.1.0) I haven't tried the solution proposed by @clementetb yet.
For not getting the issue, we deactivated the realm NDK splitting in the build.gradle.kts:
bundle {
abi {
// do not split, because of missing library crashes
enableSplit = false
}
}