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

couldn't find "librealm-jni.so" #1421

Closed
DenisBronx opened this issue Aug 25, 2015 · 91 comments
Closed

couldn't find "librealm-jni.so" #1421

DenisBronx opened this issue Aug 25, 2015 · 91 comments
Assignees

Comments

@DenisBronx
Copy link

@DenisBronx DenisBronx commented Aug 25, 2015

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

@beeender
Copy link
Contributor

@beeender beeender commented Aug 25, 2015

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

@DenisBronx
Copy link
Author

@DenisBronx DenisBronx commented Aug 25, 2015

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)

@beeender
Copy link
Contributor

@beeender beeender commented Aug 25, 2015

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

@DenisBronx
Copy link
Author

@DenisBronx DenisBronx commented Aug 25, 2015

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

@luca992
Copy link

@luca992 luca992 commented Aug 25, 2015

any updates?

@joey-harward
Copy link

@joey-harward joey-harward commented Aug 25, 2015

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

@luca992
Copy link

@luca992 luca992 commented Aug 26, 2015

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'

@DenisBronx
Copy link
Author

@DenisBronx DenisBronx commented Aug 26, 2015

thanks @luca992, it works!

@beeender
Copy link
Contributor

@beeender beeender commented Aug 26, 2015

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 beeender closed this Aug 26, 2015
@FishOSU
Copy link

@FishOSU FishOSU commented Aug 26, 2015

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.

@joey-harward
Copy link

@joey-harward joey-harward commented Aug 26, 2015

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

@chrisjenx
Copy link

@chrisjenx chrisjenx commented Aug 31, 2015

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

@chawino
Copy link

@chawino chawino commented Sep 13, 2015

This same, build issue with build tools 1.4.0-beta

@hohnamkung
Copy link

@hohnamkung hohnamkung commented Sep 16, 2015

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

@lvialle
Copy link

@lvialle lvialle commented Sep 21, 2015

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.

@cmelchior
Copy link
Contributor

@cmelchior cmelchior commented Sep 24, 2015

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 cmelchior reopened this Sep 24, 2015
@cmelchior cmelchior added the T-Bug label Sep 24, 2015
@kneth kneth added the Pending label Sep 28, 2015
@shadow7
Copy link

@shadow7 shadow7 commented Sep 30, 2015

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

@kranthipamarthi
Copy link

@kranthipamarthi kranthipamarthi commented Sep 30, 2015

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.

@lvialle
Copy link

@lvialle lvialle commented Oct 1, 2015

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.

@kevinvanmierlo
Copy link

@kevinvanmierlo kevinvanmierlo commented Oct 1, 2015

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

@JonathonFry
Copy link

@JonathonFry JonathonFry commented Oct 1, 2015

@lvialle Yeah still not fixed for me either on 1.4.0-beta3 :)

@tajchert
Copy link

@tajchert tajchert commented Oct 1, 2015

Same here with 1.4.0-beta3, dang can't use onProvideAssistContent() without it.

@tbsandee
Copy link
Contributor

@tbsandee tbsandee commented Oct 1, 2015

Same on 1.4.0-beta4. It's a shame, the 1.4.0 plugin fixes a a showstoppper bug in another area for us. It's like whack-a-mole with this stuff. :/

@balachandarlinks
Copy link

@balachandarlinks balachandarlinks commented Oct 1, 2015

This is really an annoying show stopper for my app :( Not fixed in 1.4.0-beta4 as well !

@marcelohd
Copy link

@marcelohd marcelohd commented Feb 22, 2016

Hi @cmelchior,
I will check, possible can happen in my code too

@shalperin
Copy link

@shalperin shalperin commented Mar 4, 2016

couldn't find "librealm-jni.so"
Build tools com.android.tools.build:gradle:2.0.0-beta6 (android studio 2)
"resolved" by disabling instant run.

@Queatz
Copy link

@Queatz Queatz commented Mar 6, 2016

Got around it by disabling Instant Run.

@cmelchior
Copy link
Contributor

@cmelchior cmelchior commented Mar 7, 2016

Hi @kouroshfar
Google introduced some fixes to this problem in beta6 (Realm uses native code): http://tools.android.com/recent/androidstudio20beta6availableinthecanarychannel

I'll close this issue now, but feel free to reopen if you see this on beta6 or above.

@hardysim
Copy link

@hardysim hardysim commented Mar 7, 2016

Hey, I have the same problem with Android Studio 2.0 Beta 6. Only disabling InstantRun is working.

@kneth kneth reopened this Mar 8, 2016
@Queatz
Copy link

@Queatz Queatz commented Mar 8, 2016

beta6 not working for me either, still need to disabled Instant Run.

@marcelohd
Copy link

@marcelohd marcelohd commented Mar 8, 2016

Any version starting Android Studio 2.0 (Preview), only build with instant run disable.

@kneth
Copy link
Member

@kneth kneth commented Mar 9, 2016

Let's close it as it is scheduled but out of our hands.

@kneth kneth closed this Mar 9, 2016
@iBotasky
Copy link

@iBotasky iBotasky commented Sep 30, 2016

@kneth I got the same issue, I'm trying to update the Realm from 0.87 to 2.0.0 , but i can't run the app with the problem com.getkeepsafe.relinker.MissingLibraryException: lib/armeabi/librealm-jni.so;
And my gradle version is 'com.android.tools.build:gradle:2.2.0'. I also try to disbinding the instant run and add classpath 'com.google.gms:google-services:1.3.0-beta1' in Gradle, but it doesn't work too.

@beeender
Copy link
Contributor

@beeender beeender commented Sep 30, 2016

@Botasky369 Do you have any other library which has a .so file? We removed armeabi so in 2.0.0 which will cause this problem if your other library has an armeabi so file.

@iBotasky
Copy link

@iBotasky iBotasky commented Sep 30, 2016

@beeender Yes, I found some .so in my /data/data/packagename/lib file, some like libamapv304.so/libamapv304ex.so/libBugTags.so and others . But there is not librealm-jni.so.
So you mean that we have to delete the armeabi file in our project?

@beeender
Copy link
Contributor

@beeender beeender commented Sep 30, 2016

@Botasky369 It depends. If all the libs have armeabi-v7a so files, you can safely exclude those armeabi version since all arm devices in the market today should support armeabi-v7a well.

@iBotasky
Copy link

@iBotasky iBotasky commented Sep 30, 2016

@beeender I delete the armabi file in my project, But it also doesn't work.

@iBotasky
Copy link

@iBotasky iBotasky commented Sep 30, 2016

@beeender I have clean and rebulid the projiect.

@beeender
Copy link
Contributor

@beeender beeender commented Sep 30, 2016

@Botasky369 can you decompress you final apk file, and show the list and structure of lib dir inside the apk?

@iBotasky
Copy link

@iBotasky iBotasky commented Sep 30, 2016

@beeender That's Bad, I don't know why. I can decompress the apk before I update the AndroidSutdio to 2.2
image

@iBotasky
Copy link

@iBotasky iBotasky commented Sep 30, 2016

@beeender Well, I found there has some code was suspicious at the gradle, and I delete it, and the app can run normal.Thx.
The code delete:
image
Thank again. You can close my isssue.

@rahulkumarit
Copy link

@rahulkumarit rahulkumarit commented Feb 21, 2018

compile 'io.realm:realm-android:0.87.4'
I have added but getting in error in run time..

@Zhuinden
Copy link
Contributor

@Zhuinden Zhuinden commented Feb 21, 2018

Hello, 0.87.4 is super old, the latest version is 4.3.4 5.1.0

please read https://realm.io/docs/java/latest/

@rhonyabdullah
Copy link

@rhonyabdullah rhonyabdullah commented May 7, 2018

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

java.lang.RuntimeException: Unable to create application com.myapps.android.app.Myapps: com.getkeepsafe.relinker.MissingLibraryException: lib/x86/librealm-jni.so
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5794)
        at android.app.ActivityThread.-wrap1(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1661)
        at android.os.Handler.dispatchMessage(Handler.java:105)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6541)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
     Caused by: com.getkeepsafe.relinker.MissingLibraryException: lib/x86/librealm-jni.so
        at com.getkeepsafe.relinker.ApkLibraryInstaller.installLibrary(SourceFile:85)
        at com.getkeepsafe.relinker.ReLinkerInstance.loadLibraryInternal(SourceFile:180)
        at com.getkeepsafe.relinker.ReLinkerInstance.loadLibrary(SourceFile:136)
        at com.getkeepsafe.relinker.ReLinker.loadLibrary(SourceFile:70)
        at com.getkeepsafe.relinker.ReLinker.loadLibrary(SourceFile:57)
        at io.realm.internal.RealmCore.a(SourceFile:60)
        at io.realm.Realm.a(SourceFile:258)
        at com.myapps.android.app.Myapps.initRealm(SourceFile:102)
        at com.myapps.android.app.Myapps.onCreate(SourceFile:82)
@Zhuinden
Copy link
Contributor

@Zhuinden Zhuinden commented May 7, 2018

Well if Relinker can't find it, it's not there. You might have an abiFilter set up and it removes x86.

@rhonyabdullah
Copy link

@rhonyabdullah rhonyabdullah commented May 8, 2018

So what should i do ? Is this correct if i'm doing this:

android {
packagingOptions {
        exclude 'lib/x86_64/librealm-jni.so'
    }
}
@Zhuinden
Copy link
Contributor

@Zhuinden Zhuinden commented May 8, 2018

Do you have any other native libraries that are 32-bit only?

@rhonyabdullah
Copy link

@rhonyabdullah rhonyabdullah commented May 8, 2018

No, i don't have.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
You can’t perform that action at this time.