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

couldn't find "librealm-jni.so"

Open DenisBronx opened this issue 11 years ago • 91 comments

After the last android updates i found this error in every project i use realm

this is the stacktrace:

08-25 16:03:40.457 16017-16017/it.fortech.fortechmobilepayment E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: it.fortech.fortechmobilepayment, PID: 16017 java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/it.fortech.fortechmobilepayment-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]] couldn't find "librealm-jni.so" at java.lang.Runtime.loadLibrary(Runtime.java:366) at java.lang.System.loadLibrary(System.java:988) at io.realm.internal.RealmCore.loadLibrary(RealmCore.java:114) at io.realm.internal.SharedGroup.(SharedGroup.java:35) at io.realm.Realm.(Realm.java:205) at io.realm.Realm.createAndValidate(Realm.java:594) at io.realm.Realm.create(Realm.java:564) at io.realm.Realm.getInstance(Realm.java:411) at io.realm.Realm.getInstance(Realm.java:368) at io.realm.Realm.getInstance(Realm.java:349) at it.fortech.fortechmobilepayment.account.LoginActivity.onCreate(LoginActivity.java:55) at android.app.Activity.performCreate(Activity.java:5990) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) at android.app.ActivityThread.access$800(ActivityThread.java:151) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5254) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

Tested on Nexus 5 device Android Studio 1.3 OS X 10.10.5

DenisBronx avatar Aug 25 '15 14:08 DenisBronx

@DenisBronx Can you get into the /data/data/<package_name>/lib to see if the librealm-jni.so is there?

beeender avatar Aug 25 '15 14:08 beeender

schermata 2015-08-25 alle 16 45 25

yes, and i get the same error in the emulator (i don't know the file explorer very well but i assume the lib folder is empty)

DenisBronx avatar Aug 25 '15 14:08 DenisBronx

@DenisBronx It is a symbolic link point to the anther directory. Please help to check if /data/app-lib/it.fortech.fotechmobilepayment contains the librealm-jni.so . That directory should have sub directories like x86 arm etc.

beeender avatar Aug 25 '15 14:08 beeender

@beeender it is empty i believe schermata 2015-08-25 alle 16 55 41

DenisBronx avatar Aug 25 '15 14:08 DenisBronx

any updates?

luca992 avatar Aug 25 '15 21:08 luca992

I think I'm having the same problem. Did you find a solution?

joey-harward avatar Aug 25 '15 21:08 joey-harward

Finally figured out my issue like 5 hours later.... -_- make sure your gradle version is not:

classpath 'com.android.tools.build:gradle:+'

I changed mine to the latest and it works like before

classpath 'com.android.tools.build:gradle:1.3.1'

luca992 avatar Aug 26 '15 00:08 luca992

thanks @luca992, it works!

DenisBronx avatar Aug 26 '15 07:08 DenisBronx

It is quite strange since we don't depend on any version of gradle or the android plugin… Anyway, it is good to see that this problem is solved! I am closing this issue now, thanks for the feedback!

beeender avatar Aug 26 '15 07:08 beeender

Both my coworker and I are seeing this independently and changing the gradle version did not help.

EDIT: It turns out that we had an outdated gradle version referenced at a level above. Updating that fixed everything.

FishOSU avatar Aug 26 '15 11:08 FishOSU

thanks @luca992, I actually had to set my gradle version to 1.3.0 for it work

joey-harward avatar Aug 26 '15 18:08 joey-harward

Has this been reported to b.android.com, this seems to be a build issue with build tools 1.4.0-beta.

chrisjenx avatar Aug 31 '15 13:08 chrisjenx

This same, build issue with build tools 1.4.0-beta

chawino avatar Sep 13 '15 03:09 chawino

This problem still happen in build tools 1.4.0-beta2. Is there a any progress?

hohnamkung avatar Sep 16 '15 10:09 hohnamkung

I left a bug report on the Android Developer Tools Google+ Community as I had the same issue: https://plus.google.com/+LudovicVialle/posts/7BRvbb3uKCY

I tried the Jar, same issue, the .so are not copied for any ABI. I think this is an issue within the latest build tools and Gradle.

lvialle avatar Sep 21 '15 16:09 lvialle

Reopening this just so it is more visible, in case anyone else run into this problem. However it doesn't sound like it is something we can do much about at this time unfortunately.

This bug report on the bug tracker https://code.google.com/p/android/issues/detail?id=182061 seems to indicate it is fixed but not yet released for some reason.

cmelchior avatar Sep 24 '15 06:09 cmelchior

I have a similar error message:

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

Like the error says, "lib/arm/librealm-jni.so" is missing from the compiled dependencies. I've tried downloading the realm-0.82.2.jar on the website to use as a local copy. I've extracted the contents of the jar and copied the contents of "lib/armeabi/librealm-jni.so" into the previously mentioned folder hierarchy to attempt to mitigate the error. When I repackage the jar, I can't use it to import any io.realm packages in my java like I could with the original unmodified jar.

I'm using: Android Studio 1.4 RC-2 buildToolsVersion '23.0.1'
'com.android.tools.build:gradle:1.3.2' <-- I've tried many versions explicitly

shadow7 avatar Sep 30 '15 02:09 shadow7

Had the same issue, used 'com.android.tools.build:gradle:1.2.3' to resolve.

And my app was using latest google+ integration (version 8.1.0) and I had to revert to older version of google+ library to resolve the issue.

kranthipamarthi avatar Sep 30 '15 17:09 kranthipamarthi

1.4.0-beta3 gradle plugin should fix it based on the release notes: https://sites.google.com/a/android.com/tools/tech-docs/new-build-system#release-notes

I did not tested yet.

lvialle avatar Oct 01 '15 08:10 lvialle

@lvialle No it isn't fixed yet, unfortunately. I just tried it like an hour ago.

kevinvanmierlo avatar Oct 01 '15 08:10 kevinvanmierlo