realm-java icon indicating copy to clipboard operation
realm-java copied to clipboard

Could not find 'librealm-jni.so'. Looked for: [x86], but only found: [].

Open ChrisKruegerDev opened this issue 4 years ago • 38 comments

Goal

I know there are some bugs with missing librealm-jni.so, but this is the biggest issue I have when using Realm and Bundle.

Actual Results

Users have occurred following error: Could not find 'librealm-jni.so'. Looked for: [x86], but only found: [].

Device: Nexus 4 Android version: 6.0.1

Version of Realm and tooling

Realm version(s): 6.1.0

Realm Sync feature enabled: No

Android Studio version: 4.0 Android Build Tools version: 29.0.2

Gradle version: 6.3

Which Android version and device(s): Nexus 4 / 6.0.1

ChrisKruegerDev avatar Apr 26 '20 08:04 ChrisKruegerDev

This looks a bit weird. Nexus 4 is not a x86 device. Did this error message come from running on the actual device?

I have seen that error message a few times before, but only when running apps on the emulator from inside Android Studio. In that case it is important that the ABI matches exactly the ABI of the device.

cmelchior avatar Apr 26 '20 13:04 cmelchior

Yes, it is coming from an actual device. At least no emulator from my side. Here is the full data of the Crashlytics log:

Brand: LGE Model: Nexus 4 Orientation: Portrait RAM free: 1.07 GB Disk free: 284.57 MB Operating System Version: 6.0.1 Orientation: Portrait Rooted: No

Another device is the Galaxy J2 Core.

Looked for: [armeabi-v7a, armeabi], but only found: []

Brand: samsung Model: Galaxy J2 Core Orientation: Portrait RAM free: 229.91 MB Disk free: 9.82 GB Operating System Version: 8.1.0 Orientation: Portrait Rooted: No

ChrisKruegerDev avatar Apr 27 '20 07:04 ChrisKruegerDev

It is a bit unclear what the issue is and without access to the APK itself, it might be hard to find out.

What the error says though is that the APK doesn't contain any native code for some reason. We have seen various reports of this kind from people using App Bundle, so far no conclusive root cause has been found.

cmelchior avatar May 04 '20 06:05 cmelchior

I have the same issue with LGE. so a user cannot use the app because of Looked for: [armeabi-v7a, armeabi], but only found: []

Brand: LGE Model: Nexus 4 Orientation: Portrait RAM free: 1.1 GB Disk free: 293.11 MB Operating System Version: 6.0.1 Orientation: Portrait Rooted: No

valeriandema avatar Jun 04 '20 11:06 valeriandema

What we know so far:

  1. This error happens if you run your app on an emulator that doesn't match exactly the ABI provided by Realm, e.g. if you try to run x86_64 code on an x86 emulator. C

  2. if the app has been created using App Bundles it can also happen when installing the app from Google Play. It is unclear what happens here. In theory, Google Play should ship the correct ABI to the device the APK is being installed on. It could point to an error in how Google Play handles App Bundles, but we have no concrete evidence nor idea how to test this hypothesis.

  3. It might happen if people are sideloading the APK without considering they are different architectures, but in that case, the error would look something like: Looked for: [armeabi-v7a], but only found: [x86]

We will keep this issue open in order to get more feedback.

cmelchior avatar Aug 26 '20 10:08 cmelchior

I'm also getting this error recently from devices running android 8.1.0. Motorola One Vision (rooted) and Nexus 5X

Nexus 5X android 8.1.0. Could not find 'librealm-jni.so'. Looked for: [x86], but only found: [].

Motorola One Vision (rooted) android 8.1.0. Could not find 'librealm-jni.so'. Looked for: [arm64-v8a, armeabi-v7a, armeabi], but only found: []

This issue has 23 crash events affecting 3 users. I have other native libraries in my app but I didn’t see any errors related to those libs, except the following crash that happened a month ago,

Caused by java.lang.UnsatisfiedLinkError: dlopen failed: library "/data/app/~~9XihzNW7ULPF6yR6-VVj4Q==/com.myapp.package-mK9ZhQGY7rMRjU2sukTrUA==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libsecrets.so" not found

Can this happen if someone is trying to modify the apk?

SujithManjavana avatar Oct 28 '22 08:10 SujithManjavana

Hi @SujithManjavana. If somebody repacks the apk it could be an issue, so anything like that would be a possibility and there is even more things that could be off with rooted devices (repackaging on installation ect.).

It if get further we insight into what is going on, please feel free to share.

rorbech avatar Oct 28 '22 12:10 rorbech

This error is spiking in my Crashlytics dashboard. This issue has 40 crash events affecting 7 users (My app only has less than 3000 installs). These are the devices affected, Nexus 5X HUAWEI WDGF4587 QEMU Standard PC (Q35 + ICH9, 2009) <= Someone experimenting with my apk? Motorola One Vision

For a similar issue, someone suggested to use android.bundle.enableUncompressedNativeLibs=false https://github.com/algolia/algoliasearch-client-android/issues/576#issuecomment-494148605

https://corbt.com/posts/2015/09/18/mixing-32-and-64bit-dependencies-in-android.html This blog post says that Android won't be able to load 32- and 64-bit native libraries concurrently. In my app, I'm also using other libraries such as uCrop. The solution he suggested is to simply exclude all 64-bit binaries from your APK.

Does anyone know the implications of the above-mentioned fixes?

SujithManjavana avatar Oct 29 '22 11:10 SujithManjavana

The same issue as above: Could not find 'librealm-jni.so'. Looked for: [x86], but only found: []. Device: Nexus 5X Android 8.1.0

alexeyVh avatar Nov 06 '22 01:11 alexeyVh

@alexeyVh @SujithManjavana This has started appearing to my app after updating com.android.tools.build:gradle to 7.3.1 from version 7.3.0. Also in that deployment I have updated com.google.firebase:firebase-crashlytics to 18.3.1 from version18.2.13.

Does anything from above seems similar to your case? Have you solved the issue yet?

farmaker47 avatar Nov 16 '22 08:11 farmaker47

@farmaker47 absolutely the same for me. The issue not solved, but doesn't seem critical - happens on two devices where one is rooted.

alexeyVh avatar Nov 16 '22 14:11 alexeyVh

In my case, there were non-rooted phones too. 'com.android.tools.build:gradle:7.2.2'

SujithManjavana avatar Nov 16 '22 15:11 SujithManjavana

Similar crash for me: Could not find 'librealm-jni.so'. Looked for: [arm64-v8a, armeabi-v7a, armeabi], but only found: []. It's mostly on rooted devices, but is still occurring on a handful of non-rooted devices. Rooted devices:

  • Motorola One Vision (Android v8.1.0)
  • Galaxy Tab A (Android v7.1.2)

Non-rooted:

  • MOA-LX9N (Android v10)

ProgrammedForAdventure avatar Dec 14 '22 15:12 ProgrammedForAdventure

Unfortunately I had to remove completely the library.

farmaker47 avatar Dec 14 '22 15:12 farmaker47

Same issue here, LGE Nexus 5x, Android 8.1.0, not rooted

daniel-reinhold avatar Dec 20 '22 11:12 daniel-reinhold

I have some events in crashlytics logging this error. The problem is specific for the LGE Nexus 5.

monossido avatar Jan 24 '23 11:01 monossido

Sentry reveals that devices which the app crashes from installed the sideloaded apk. It could be a reason.

alexeyVh avatar Jan 24 '23 12:01 alexeyVh

I also experience the issue in my app, there are quite many crashes for several users. And as mentioned before the issue happens mainly for LGE Nexus 5 Android 8.1.0 (but not only).

I unpacked the bundle binary and it looks like all required versions of realm library are there. So it's more about serving a proper version of the library from Google Play to devices. But not sure if it depends on any realm and/or app project settings. I don't see such issue for other used libraries.

rmaciejczyk avatar Jan 27 '23 17:01 rmaciejczyk

I have the same issue, since we switched to app bundles recently.

Maybe interesting - to use our app, a user needs to be logged in and we're adding the user's id in the crash report. For all reported crashes, there was no user logged in, which is very strange (as it is only rolled out to beta users at the moment, and you'd expect them to be logged in). Since APK sideloading was mentioned by others, I was thinking, maybe the crashes could be caused by some of those alternate app stores that exist, which basically grab apps from the playstore, convert into APKs and provide them?

ridcully99 avatar Jan 31 '23 07:01 ridcully99

I have seen this issue too for LG Nexus 5

sipersso avatar Mar 18 '23 07:03 sipersso

Nexus 5X here, too

ssuukk avatar Mar 21 '23 11:03 ssuukk

Getting reports too with the same device.

ppamorim avatar Mar 22 '23 12:03 ppamorim

Nexus 5 here too. Same issue.

chriscataldo avatar Mar 24 '23 15:03 chriscataldo

Same issue.

  • Huawei Enjoy 9s (Android 8.1.0)
  • Nexus 5X (Android 8.1.0)
  • OnePlus8Pro (Android 11)

NicolasEymael avatar Mar 27 '23 12:03 NicolasEymael

Android Version: 8.1.0 Device: Samsung Galaxy J2 Core

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{activity.MainActivity}: w3.b: Could not find 'librealm-jni.so'. Looked for: [armeabi-v7a, armeabi], but only found: []. at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2789) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2872) at android.app.ActivityThread.-wrap11() at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1595) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6543) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:440) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:810)

EzequielAdrianM avatar Apr 14 '23 22:04 EzequielAdrianM

Same here on Nexus 5X, Galaxy J7 Pro, Android 8. K30 PRO, Android 12. Find X6, Poco F5 Pro, Galaxy S23 Ultra, Galaxy S23, Xperia 1 V, Android 13.

Fatal Exception: java.lang.RuntimeException: Unable to create application com.ihad.ptt.App: com.getkeepsafe.relinker.MissingLibraryException: Could not find 'librealm-jni.so'. Looked for: [x86], but only found: []. at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5743) at android.app.ActivityThread.-wrap1() at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

Fatal Exception: java.lang.RuntimeException: Unable to create application com.ihad.ptt.App: com.getkeepsafe.relinker.MissingLibraryException: Could not find 'librealm-jni.so'. Looked for: [armeabi-v7a, armeabi], but only found: []. at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6100) at android.app.ActivityThread.-wrap1() at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1791) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:7000) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:441) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)

Fatal Exception: java.lang.RuntimeException: Unable to create application com.ihad.ptt.App: com.getkeepsafe.relinker.MissingLibraryException: Could not find 'librealm-jni.so'. Looked for: [arm64-v8a, armeabi-v7a, armeabi], but only found: []. at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7246) at android.app.ActivityThread.-$$Nest$mhandleBindApplication() at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2296) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:240) at android.os.Looper.loop(Looper.java:351) at android.app.ActivityThread.main(ActivityThread.java:8399) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1013)

com.android.tools.build:gradle:7.4.2 io.realm:realm-gradle-plugin:10.5.1 io.realm:realm-gradle-plugin:10.16.1

Android app bundle.

KimiChiu avatar Jul 15 '23 12:07 KimiChiu

We cannot tolerate our app crashing, but this error is so fundamental that our app can't work without a database, so we just catch the error, record the event on crashlytics and finish the application. It's a temporal fix since this error doesn't happen very frequently.

try {
     Realm.init(context);
} catch (RuntimeException e) {
     FirebaseCrashlytics.getInstance().recordException(e);
     finish();
     return;
}

EzequielAdrianM avatar Jul 15 '23 13:07 EzequielAdrianM

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 Realm Kotlin SDK1.10.0 we disabled Relinker on Android 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 are not able to reproduce the issue at our end.

  • setting the gradle property enableUncompressedNativeLibs=false, or
  • adding the following to your build.gradle:
android {
    packagingOptions {
        jniLibs {
            useLegacyPackaging = true
        }
    }
}

clementetb avatar Jul 17 '23 08:07 clementetb

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 Realm Kotlin SDK1.10.0 we disabled Relinker on Android 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 are not able to reproduce the issue at our end.

  • setting the gradle property enableUncompressedNativeLibs=false, or
  • adding the following to your build.gradle:
android {
    packagingOptions {
        jniLibs {
            useLegacyPackaging = true
        }
    }
}

No, it's not.

Fatal Exception: java.lang.RuntimeException: Unable to create application com.ihad.ptt.App: com.getkeepsafe.relinker.MissingLibraryException: Could not find 'librealm-jni.so'. Looked for: [x86], but only found: [].
       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5743)
       at android.app.ActivityThread.-wrap1()
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6494)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

KimiChiu avatar Jul 22 '23 11:07 KimiChiu

@KimiChiu Thanks for trying, but what did you try that is not working? Was it the enableUncompressedNativeLibs or the useLegacyPackaging?

clementetb avatar Jul 24 '23 08:07 clementetb