I am using a library in my project to play videos. The library comes up with a demo project. The demo project is working fine.
The library has few .Jar files, some library classes, and a lot of .so files. The demo project put the Jar files in lib folder and .so files in armeabi and x86 folder.
I did the same, but it start giving me following error message.
UnsatisfiedLinkError (Can't find dependent libraries)
Then i put these .so files in armeabi-v7a folder, and the error is gone.
but still its not working completely fine.
Its not giving me any error message, but still its also not initializing the class that is available in the Decompiled.class file. The same class is initializing successfully in demo project. I found out this problem after debugging both projects.
I have checked each and everything, the only difference i can see in demo and my project is armeabi-v7a and armeabi.
So do files compiled for armeabi have some problems with armeabi-v7a, or it can be some other problem.
arm-eabi vs armeabi-v7a should not be the problem. At the low level, armeabi-v7a is compatible with armeabi, but not vice versa.
Can you add more debug and give more info?
Related
I have created a spring application which uses google or-tools. For that, I am importing jniortools using System.loadLibrary("jniortools"). when I provide the .dll file and run the war file it runs perfectly. But when I provide the .so file path in lib, I get the unsatisfiedlinkerror.
Taken from here, a solution for using or-tools over Intellij:
To make it work using Intellij (over a windows machine) you need to:
Install Microsoft Visual C++ Redistributable for Visual Studio
Download and extract the OR-Tools library for Java
In intellij, add jar dependency to the 2 jars under the lib folder of the extracted files (each of the 2 jars separately, do not add to lib folder itself. This is why).
Add the lib library path to VM options. In Intellij edit your run-configuration and add to vm options: -Djava.library.path=<path to the lib folder that hold the jars>
Load the jni library statically by adding the below code to your class (as mentioned here.)
static {
System.loadLibrary("jniortools");
}
I got problem during adding library into Android Studio project.
I add jar file to directory libs. I clicked Add as library and the problem is that when I try to run project, it fails.
The problem is decompiled .class file bytecode version 51.0 (Java 7).
Error in Android Monitor is NoClassDefFound.
What I got for now, is that I should have java files, but I have .class files.
Can anybody tell me how to solve this problem?
I solve my problem just using Java Decompiler and adding new java files to project.
I have an android project and I added an external .jar file which contains several .class files and in addition some .so files.
When I try to use some methods which are provided by the .class files I get a UnsatisfiedLinkError-Exception which says that the implementation for those methods couldn't be found.
Obviously the problem is that the .so libraries which contain the implementation were not correctly loaded/cannot be found.
What do I have to do that the native libraries in the external .jar file can be found from the runtime?
More details:
I'm using AndroidStudio and the app is tested on the emulator with the device "Nexus 5 API 23 x86". The .so files support x86 too.
I copied the .jar file into the /app/libs folder. Then I right-clicked the file in the IDE and selected "Add as library".
As you see that crash is saying that it could not load native library. But why?
First of all I checked my structure, If native library .so files located correctly.
Seems everything was okay except this crazy error.
Then after some research, I find out that some of android devices has 64-bit processors.
This devices generates and check arm64 folder to load native library.
That was the problem. Because my project does not have arm64 folder.
Here is the solution;
defaultConfig{
ndk {
abiFilters "armeabi-v7a", "x86", "armeabi", "mips"
}
}
I am trying to setup a java based opencv program to run on raspberry-pi.I installed opencv-2.4.8 on my raspberry-pi. I also installed eclipse to set up opencv.The problem is i am not able to link native libraries for my opencv-2.4.8 jar file in eclipse.
Eclipse is running fine with raspberry-pi and i am able to compile and run simple java programs.From where to link the native library for opencv2.4.8 jar file.
I checked my opencv folder and it is having the following structure.
MY OpenCV Folder
Opencv release folder
Found the following opencv .so files in usr/local/lib folder of my pi. Is this is what i should link to my native library. But there are many .so files also.
The output console with the error is as follows. sorry the screenshot skipped unsatisfied link error..
I had the same error which come up like this. I have an application that I have to run. I build and install opencv and try to run but I see that error like you. For solving this issue I replace old opencv_*jar with built one in opencv directory. You have to use jar file that you have just built.
..../opencv/build/bin/opencv-2410.jar
I thing old jar looks for different native path.
I had the same issue. I set my Native Lib Location to {OpenCV directory}/{Build directory}/lib and things worked fine.
I have downloaded code http://code.google.com/p/aacplayer-android/downloads/detail?name=aacplayer-android-r25.zip&can=2&q= for playing AAC file in ANDROID
and below is image of that code in eclipse
Here you can see that there is jni folder and libs folder in LIBS folder also contain .so files
Currently i have not installed any NDK and i have imported this project which is working fine...
but if i use this files and code into my project should i have to install NDK?
I have copy and paste this jni and libs folder to my application, now what should i have to do! How to tell my apps that this is the native code!
my apps folder structor is (after copy paste) below
If you do not want to rebuild the .so files you should not need the NDK. Eclipse/Java/Android will handle them as fine as native java libraries. You need the ANdroid NDK if you want to be able to compile c/c++ code for the android platform.