realm-java: App Bundle: MissingLibraryException

Goal

To find a solution for ABI related problems

Expected Results

To run all split versions of app successfully

Actual Results

Fatal Exception: java.lang.RuntimeException: Unable to create application my.app.AppMain: com.b.a.b: lib/armeabi/librealm-jni.so
       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4715)
       at android.app.ActivityThread.-wrap1(ActivityThread.java)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
Caused by com.b.a.b: lib/armeabi/librealm-jni.so
       at com.b.a.a.a(ApkLibraryInstaller.java:85)
       at com.b.a.d.a(ReLinkerInstance.java:180)
       at com.b.a.d.a(ReLinkerInstance.java:136)
       at com.b.a.c.a(ReLinker.java:1070)
       at io.realm.internal.m.a(RealmCore.java:60)
       at io.realm.v.a(Realm.java:258)
       at my.app.AppMain.onCreate(AppMain.java:256)
       at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013)
       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4712)
       at android.app.ActivityThread.-wrap1(ActivityThread.java)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)

Version of Realm and tooling

Realm version(s): 5.1.0 Android Studio version: 3.2 canary 15

Which Android version and device: Nexus 5X tries to load x86, but most reported devices try armeabi Many different devices are affected App is not using other so files than Realm.

From the Google Play dashboard I can see that no armeabi version is generated, only the 5 that Realm uses.

Edit: removed the x86 from the stacktrace, that was confusing

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 54 (19 by maintainers)

Most upvoted comments

Unfortunately, I still get the same issue with Realm version 5.7.0.

Samsung SM-G965F LGE Nexus 5X

relinker issue

@Zhuinden the MissingSplitsManager didn’t work for me when I tried an APK with ndk { abiFilters "mips" } on a x86 emulator.

Instead I’m catching the RuntimeException and show a toast.

Update from: https://issuetracker.google.com/issues/109448556

The source of the install can unfortunately be faked quite easily with “adb” and it looks like a bunch of users have learnt to do that (for reasons that I’m not entirely sure of yet). We haven’t received any end-user report either that an install from Play was failing for them. A few other developers are facing the same issue and none of them have been able to reproduce the issue either. All of this seems to confirm that the issue is indeed sideloading (with for some users faking the source of the install) so I will close this bug for now. If you have any end-user reporting that the install is failing when installing from Play store, feel free to re-open this bug providing the details. Note that we are also actively working on a solution to avoid the crashes on the users having installed only a subset of the required APKs. This should help remove those crashes from your reports altogether . Stay tuned.

Unfortunately, it seems at this point in time that the only way to avoid this issue is to avoid using AppBundle. Note that if users are indeed installing the wrong bundle, they will probably also experience other issues, like images having the wrong size or localization not working correctly.

I have a similar issue using Android App Bundle.

Caused by com.getkeepsafe.relinker.MissingLibraryException
lib/x86/librealm-jni.so
arrow_right
com.getkeepsafe.relinker.ApkLibraryInstaller.a (Unknown Source)
com.getkeepsafe.relinker.ReLinkerInstance.b (Unknown Source)
com.getkeepsafe.relinker.ReLinkerInstance.a (Unknown Source)
com.getkeepsafe.relinker.ReLinker.a (Unknown Source)
io.realm.internal.RealmCore.a (Unknown Source)
io.realm.Realm.a (Unknown Source)

and

Caused by com.getkeepsafe.relinker.MissingLibraryException
lib/armeabi/librealm-jni.so
com.getkeepsafe.relinker.ApkLibraryInstaller.a (Unknown Source)
com.getkeepsafe.relinker.ReLinkerInstance.b (Unknown Source)
com.getkeepsafe.relinker.ReLinkerInstance.a (Unknown Source)
com.getkeepsafe.relinker.ReLinker.a (Unknown Source)
io.realm.internal.RealmCore.a (Unknown Source)
io.realm.Realm.a (Unknown Source)

Filed an issue on Google side to check if it’s a fault on the bundle system itself: https://issuetracker.google.com/issues/109448556

You are most likely missing this check on YOUR side: https://developer.android.com/guide/app-bundle/sideload-check#application_class_check

You should make sure that the APK installed by the user has the library variant in Realm.

If you are using Android App Bundle, then you should have this check in your Application class.

This is not a problem with Realm.

Have just update the classpath to classpath “io.realm:realm-gradle-plugin:5.11.0”

Note that users in India, Africa have much higher tendency to “share” apk files due to the cost and speed of bandwidth there.

We have zero reports of this issue with users that installed from offiial Play store via bundle split apks. I do not believe this can be solved by relinker or any so loader since if you manually install the wrong apk, you are missing .so files period. No ammount of wrangling will let your app open realm files.

Note that if you use realm with relinker 1.3.0+, there is absolutely no issue barring human error.

Waiting for a 5.5.1 version really much, it’s the only obstacle for us to make an APK almost three times smaller. Are there any estimates for this release?

A PR is currently in review that should fix this: https://github.com/KeepSafe/ReLinker/pull/46 Once this PR has been approved and merged we will upgrade the Relinker version used.