1

My application is working fine with realm. and in another project I have a working GCM (push notification) application. But what I need is both things working in my one app, so combing the code in one I started getting the following exception.

I have found some threads for the same issue like this, updated gradle to gradle-2.8, but no luck so far.

Any help to solve this issue is highly appreciated.

E/AndroidRuntime: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/euxxxx-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]] couldn't find "librealm-jni.so"

SSH
  • 1,609
  • 2
  • 22
  • 42
  • http://stackoverflow.com/questions/27186726/java-lang-unsatisfiedlinkerror-dalvik-system-pathclassloader – IntelliJ Amiya Nov 16 '15 at 11:50
  • http://stackoverflow.com/questions/27325140/dalvik-system-pathclassloader-cant-find-jni-on-intel-devices – IntelliJ Amiya Nov 16 '15 at 11:51
  • 1
    @IntelliJAmiya firstly thanks, I have checked the links but can you help me fixing this, as they are working separately but why combing them arises such issues, I really didn't get how to solve this using the links you provided – SSH Nov 16 '15 at 11:56
  • @SSH What build tools version are you using? i.e. classpath 'com.android.tools.build:gradle:1.5.0' – Intrications Nov 16 '15 at 22:16
  • https://realm.io/docs/java/latest/#couldnt-load-librealm-jniso Would this be helpful? @SSH – beeender Nov 17 '15 at 02:39
  • thnx , @beeender you can post an answer so i can accept it,your solution works, – SSH Nov 17 '15 at 09:52
  • See [Realm FAQ Couldn't load librealm-jni.so](http://realm.io/docs/java/latest/#couldnt-load-librealm-jniso). – beeender Nov 17 '15 at 16:00

1 Answers1

3
  1. Go to Realm Website
  2. Click in FAQ
  3. Search "Couldn’t load librealm-jni.so”
  4. You will see update information

TDLR;

In Realm documentation you can find the following:

Couldn’t load “librealm-jni.so” If your app uses other native libraries that don’t ship with support for 64-bit architectures, Android will fail to load Realm’s librealm-jni.so file on ARM64 devices. This is because Android cannot load 32-bit and 64-bit native libraries concurrently. The best solution would be to have all libraries provide the same set of supported ABIs, but sometimes that may not be doable if you are using a 3rd-party library. See VLC and Realm Library conflicts.

The workaround to this issue is to exclude Realm’s ARM64 library from the APK file by adding the following code to the app’s build.gradle. You can refer to Mixing 32- and 64-bit Dependencies in Android for more information.

android {
    //...
    packagingOptions {
        exclude "lib/arm64-v8a/librealm-jni.so"
    }
    //...
}

Also, there is a bug with Android Gradle Plugin 1.4.0 betas that leads it to improperly pack .so files included in jar files (see Realm Java issue 1421). To solve this problem, you can revert to Android Gradle Plugin 1.3.0 or use Android Gradle Plugin 1.5.0+.

We are aware of a number of 3rd party libraries, frameworks and management apps which do not have 64-bit support yet:

Parallel Space—but you can advice your users to install the 64 bit version instead. RenderScript—NDK r14 will probably support 64 bit. Unity3d.

Nota: Hello, this is appear again if i'm using proguard on my release buildTypes

Cristofer
  • 1,046
  • 13
  • 21