I am trying to use secugen sdk in which I have binded a jar with project. I have added required jar and .so files to project.I have added required .so files by making a lib folder and inside lib folder making sub folders armeabi and x86.
Inside this sub folders I have placed the .so files.At runtime I'm getting exception as follows:
Java.Lang.UnsatisfiedLinkError:
dalvik.system.PathClassLoader[DexPathList[[zip file
"/data/app/fingerprint.fingerprint-1/base.apk"],nativeLibraryDirectories=[/data/app/fingerprint.fingerprint-1/lib/arm,
/data/app/fingerprint.fingerprint-1/base.apk!/lib/armeabi-v7a,
/vendor/lib, /system/lib]]] couldn't find "libjnisgfplib.so"
Related
I'm trying to build tutorial-2-mixedprocess application (in android-studio) that came with the opencv-SDK 3.2.0. But my application crashes because of a missing mixed_sample library
// Load native library after(!) OpenCV initialization
System.loadLibrary("opencv_java3"); //This one is taken care in CmakeLists.txt
Log.d(TAG, "Loaded the opencv"); //This line appears on the monitor
System.loadLibrary("mixed_sample"); // C-R-A-S-H h h h
I looked inside OpenCV-android-sdk/sdk/native/libs directory that came with opencv-3.2.0-android-sdk.zip but *mixed_sample.so is nowhere to be found.
Where to find this file?
EDIT
The full error says following:
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/org.opencv.samples.tutorial2-1/base.apk"],nativeLibraryDirectories=[/data/app/org.opencv.samples.tutorial2-1/lib/x86, /vendor/lib, /system/lib]]] couldn't find "libmixed_sample.so"
In Android Studio do the following
Create Folder "jniLibs" inside "src/main/"
Put all your .so libraries inside "src/main/jniLibs" folder
just sync gradle again and project. Run your application.
make sure you have put java and jnilibs at proper places.
can you share tree structure of project screenshot?
I am trying to add armeabi .so files in my Android Studio project. Which will be accessed by .jar files of an SDK. Basically I am using Brothers Printers SDK and integrating them in my app. THe problem is, the .jar files are picked up in the Android Studio Project but when I try to access a method of the SDK, it gives me this error:
java.lang.UnsatisfiedLinkError: Couldn't load createdata from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.wingoku.printerapp-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.wingoku.printerapp-1, /vendor/lib, /system/lib]]]: findLibrary returned null
at java.lang.Runtime.loadLibrary(Runtime.java:358)
at java.lang.System.loadLibrary(System.java:526)
at com.brother.ptouch.sdk.JNIWrapper.<clinit>(JNIWrapper.java:16)
at com.brother.ptouch.sdk.Printer.setPrinterInfo(Printer.java:887)
at com.wingoku.printerapp.print.printprocess.BasePrint.setPrinterInfo(BasePrint.java:73)
at com.wingoku.printerapp.print.printprocess.BasePrint$PrinterThread.run(BasePrint.java:433)
I have tried putting the armeabi folder inside the src/main/jniLibs but the .so files are not getting picked up and I keep getting the mentioned exception.
What can I do resolve it?
The method which helped me is:
make a directory on your desktop name it 'lib'
take your jnilibs folders with *.so files and paste it in lib.
now zip your lib folder
and then change its extention from .zip to .jar
that is lib.zip to lib.jar
now copy this into your libs folder of your project and update you gradle by adding this line in dependencies:
compile fileTree(include: 'lib.jar',dir:'libs')
this is the safest method to load any jnilibs. i applied it with opencv libs
if also problem persists add reference of NDK-root in your app.
hope this helps.
Hi in my Android project I need to access some C++ code so I created shared library project on
Linux and generated .so file .
Now when I put this .so file inside libs/armeabi folder in my Android project and I load that .so file via code as
System.loadLibrary("name of so file without prefix lib and extention .so");
I am getting
12-30 17:01:12.628: E/AndroidRuntime(6472): java.lang.UnsatisfiedLinkError: Cannot load library: get_lib_extents[758]: 104 - /data/data/com.example.demo/lib/libextractimage.so is not a valid ELF object
Now I dont know why I am getting this issue and where is the problem
Please help me.
The Error I will get is
Couldn't load json from loader dalvik.system.PathClassLoader[DexPathList[dexElements=[zip file "/data/app/com.uei.tools.ndktest-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.uei.tools.ndktest-1, /vendor/lib, /system/lib]]]: findLibrary returned null
I created a zip file of all .so files and i added into libs folder under app folder i added jar dependency from Module settings dependency.
All serch resulted in sample code of old versions of android studio but there is no sample for Android studio 0.8.6 beta
With Android Studio 0.8.x, you can directly add your prebuilt .so files under a jniLibs folder, inside folders corresponding to each ABIs. For example:
app/src/main/jniLibs/armeabi-v7a/libMyLib.so
app/src/main/jniLibs/x86/libMyLib.so
You can find up-to-date samples at the bottom of this page: http://tools.android.com/tech-docs/new-build-system#sites-attachments
I have an Android project A, with ndk and jni features.
It also links to another library project B.
In order to make things simpler, I remove the linked library project B,
and add the compiled .jar file and its .so files in /libs from B.
I put a line
System.loadLibrary("libfromB.so");
Now I clean and rebuild the project A. All is fine.
I find that every time I run the project, libfromB.so in /libs is deleted.
So it will complain:
02-21 17:47:26.493: E/AndroidRuntime(24086): java.lang.UnsatisfiedLinkError: Couldn't load fromB from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.android.askquestion.app-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.android.askquestion.app-1, /vendor/lib, /system/lib]]]: findLibrary returned null
However, I see some Android projects from open source, they have some .so files put in /libs, and they are not deleted automatically.
You should not put your .so files directly under the libs/ directory, but rather under an architecture appropriate subdirectory, for example
project/libs/armeabi/libfromB.so
It is possible that if your IDE believes your project has native code, it might be running an NDK build subsystem which is cleaning that directory.
System.loadLibrary() takes a short library name, not a filename. So if your library is called "libfromB.so" you should use
System.loadLibrary("fromB");