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

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

Open
ChrisKruegerDev opened this issue Apr 26, 2020 · 40 comments

Comments

@ChrisKruegerDev
Copy link

ChrisKruegerDev commented Apr 26, 2020

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

@cmelchior
Copy link
Contributor

cmelchior commented Apr 26, 2020

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.

@ChrisKruegerDev
Copy link
Author

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

@cmelchior
Copy link
Contributor

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.

@valeriandema
Copy link

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

@cmelchior
Copy link
Contributor

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.

@SujithManjavana
Copy link

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?

@rorbech
Copy link
Contributor

rorbech commented Oct 28, 2022

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.

@SujithManjavana
Copy link

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?

@alexeyVh
Copy link

alexeyVh commented Nov 6, 2022

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

@farmaker47
Copy link

@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?

@alexeyVh
Copy link

alexeyVh commented Nov 16, 2022

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

@SujithManjavana
Copy link

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

@ProgrammedForAdventure
Copy link

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)

@farmaker47
Copy link

Unfortunately I had to remove completely the library.

@daniel-reinhold
Copy link

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

@monossido
Copy link

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

@alexeyVh
Copy link

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

@rmaciejczyk
Copy link

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.

@ridcully99
Copy link

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?

@sipersso
Copy link

I have seen this issue too for LG Nexus 5

@ssuukk
Copy link

ssuukk commented Mar 21, 2023

Nexus 5X here, too

@ppamorim
Copy link

Getting reports too with the same device.

@chriscataldo
Copy link

chriscataldo commented Mar 24, 2023

Nexus 5 here too. Same issue.

@NicolasEymael
Copy link

Same issue.

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

@EzequielAdrianM
Copy link

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)

@KimiChiu
Copy link

KimiChiu commented Jul 15, 2023

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.

@EzequielAdrianM
Copy link

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;
}

@clementetb
Copy link
Collaborator

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
        }
    }
}

@KimiChiu
Copy link

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)

@clementetb
Copy link
Collaborator

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

@KimiChiu
Copy link

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

I tried both of them. The downloading size decreased from 42 to 20. I supposed it's working as the member of Google issue expected. So this setting is working but it couldn't fix it.
In my case, it only happened on specific devices rarely. I have more than 200k active users but this problem only occurs on less than 10 users repeatedly. 1 or 2 devices of them are rooted.

@ghost
Copy link

ghost commented Oct 5, 2023

Is there any fix to this, my errors are showing up in Firebase Testlab on a virtual device, no issues testing on through the Android Studio emulator or a real device. Testlab errors are generally reliable but I'm not sure what to do in this case

Robo test, Pixel 2, Virtual, API level 30
Failed
05/10/2023, 11:44
1 m 10 s
Portrait
English (United States)
Test issues
Robo
Logs
Screenshots
Videos
Performance
Accessibility
Fatal exception
at byj.run(:com.google.android.gms.policy_maps_core_dynamite@[email protected]:2)
FATAL EXCEPTION: androidmapsapi-Background_2
Process: com.xxxxx.tracker, PID: 12801
baw: Exception while extracting native library.
at com.google.android.apps.gmm.jni.util.NativeHelper.safeLoadLibrary(:com.google.android.gms.policy_maps_core_dynamite@[email protected]:8)
at com.google.android.apps.gmm.jni.util.NativeHelper.ensureLibraryLoaded(:com.google.android.gms.policy_maps_core_dynamite@[email protected]:4)
at dcu.run(:com.google.android.gms.policy_maps_core_dynamite@[email protected]:0)
at bwx.run(:com.google.android.gms.policy_maps_core_dynamite@[email protected]:0)
at byj.run(:com.google.android.gms.policy_maps_core_dynamite@[email protected]:2)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at bxu.run(:com.google.android.gms.policy_maps_core_dynamite@[email protected]:4)
at java.lang.Thread.run(Thread.java:923)
Caused by: baw: Zip entry 'lib/x86_64/libgmm-jni.so' not found in APK '/data/app/~~PTXqqKq_rCGH4fHKlKfcwQ==/com.lbrooks.tracker-KlwM1SylzjtTtHxNkd2KQA==/base.apk'
at com.google.android.apps.gmm.jni.util.NativeHelper.safeLoadLibrary(:com.google.android.gms.policy_maps_core_dynamite@[email protected]:6)
... 8 more
Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: library "libgmm-jni.so" not found
at java.lang.Runtime.loadLibrary0(Runtime.java:1087)
at java.lang.Runtime.loadLibrary0(Runtime.java:1008)
at java.lang.System.loadLibrary(System.java:1664)
at com.google.android.apps.gmm.jni.util.NativeHelper.safeLoadLibrary(:com.google.android.gms.policy_maps_core_dynamite@[email protected]:1)
... 8 more

@ghost
Copy link

ghost commented Oct 5, 2023

Update from my previous comment...
I found that Firebase Crashlytics was commented out, after allowing Crashlytics the Firebase Testlab ran successfully

@vernazza
Copy link

The problem seems to be still present

@klaasel
Copy link

klaasel commented May 28, 2024

The problem seems to be still present

Indeed. Our Android app has the same problem for Nexus 5X at moment of writing. Since the previous deployment we upgraded the next libraries:

  • Android 14 (compileSdk and targetSdk 34)
  • io.realm:realm-gradle-plugin to 10.12.0. Could upgrade to 10.18.0
  • com.android.tools.build:gradle still on 7.3.0. Could upgrade to 7.3.1
  • com.google.firebase:firebase-bom to 32.8.0
  • com.google.dagger:hilt-android-gradle-plugin to 2.48
  • org.jetbrains.kotlin:kotlin-gradle-plugin to 1.9.0

@iolandarosavoid
Copy link

I also have the same crash on Nexus 5X device and I am using realm version 10.15.1

@root1991
Copy link

root1991 commented Jun 6, 2024

Issue still happens with realm 10.15.1 on Nexus 5x Android 8.1.0

@ceggert87
Copy link

I'm also noticing a bunch of reports with 10.18.0 still. One thing I noticed in a manual test was that - at least for my test device - it seemed related to the Play Store. I downloaded the application and executed it directly from the store, and then ended up with this exception. After starting the app manually again directly, it started successfully. Not sure if that is also the case for all the crash reports I'm seeing, though.

@juckrit
Copy link

juckrit commented Oct 28, 2024

Is there any update on this issue, I still have this problem

@ridcully99
Copy link

As Realm has been deprecated by MongoDB (see Realm/Atlas documentation at MongoDB website), nothing will happen here any more.

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