Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using Realm in Android project with armeabi support only

I'm trying to use Realm. I setup the build.gradle and called Realm.init(context) on app start.

The problem is, the app crashes on launch.

Here's the log:

java.lang.RuntimeException: Unable to create application com.test.android com.getkeepsafe.relinker.MissingLibraryException: lib/armeabi/librealm-jni.so
                                                                         at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5406)
                                                                         at android.app.ActivityThread.-wrap2(ActivityThread.java)
                                                                         at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545)
                                                                         at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                         at android.os.Looper.loop(Looper.java:154)
                                                                         at android.app.ActivityThread.main(ActivityThread.java:6119)
                                                                         at java.lang.reflect.Method.invoke(Native Method)
                                                                         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
                                                                         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
                                                                      Caused by: com.getkeepsafe.relinker.MissingLibraryException: lib/armeabi/librealm-jni.so
                                                                         at com.getkeepsafe.relinker.ApkLibraryInstaller.installLibrary(ApkLibraryInstaller.java:85)
                                                                         at com.getkeepsafe.relinker.ReLinkerInstance.loadLibraryInternal(ReLinkerInstance.java:180)
                                                                         at com.getkeepsafe.relinker.ReLinkerInstance.loadLibrary(ReLinkerInstance.java:136)
                                                                         at com.getkeepsafe.relinker.ReLinker.loadLibrary(ReLinker.java:70)
                                                                         at com.getkeepsafe.relinker.ReLinker.loadLibrary(ReLinker.java:57)
                                                                         at io.realm.internal.RealmCore.loadLibrary(RealmCore.java:59)
                                                                         at io.realm.Realm.init(Realm.java:187)

The project uses another library that only supports armeabi. that's why I added an abiFilter

ndk { abiFilters "armeabi" }

Adding other values in here will cause that library to crash.

Is there a way for me to use Realm for "armeabi" only?

like image 873
kishidp Avatar asked Feb 23 '17 09:02

kishidp


3 Answers

I also faced the same issue.Just now solved it by adding this realm version to project level gradle classpath 'io.realm:realm-gradle-plugin:6.0.0'

link here

like image 52
Debasish Ghosh Avatar answered Oct 02 '22 15:10

Debasish Ghosh


Solved.

just to updated gradle classpath to classpath "io.realm:realm-gradle-plugin:5.11.0"

 dependencies {
    classpath 'com.android.tools.build:gradle:3.2.1'
    classpath 'com.google.gms:google-services:4.0.1'
    classpath "io.realm:realm-gradle-plugin:5.11.0"

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files`enter code here`


}
like image 41
Ankur Yadav Avatar answered Oct 02 '22 14:10

Ankur Yadav


I think your problem is that since Realm 2.0, armeabi support was removed, and only armeabi-v7 works (read change log: armeabi is not supported anymore).

There is an issue tracking it here.

However, you can still use Realm 1.2.0, which works just as well. You can refer to this guide for the breaking changes in 2.x so that you can revert that behavior, otherwise it works exactly the same.

like image 34
EpicPandaForce Avatar answered Oct 02 '22 15:10

EpicPandaForce