FATAL EXCEPTION: main java.lang.UnsatisfiedLinkError in the Android Studio library

I added the FDxSDKProAndroid.jar file to the libs folder of my project in android studio. Also added a dependency in the build.gradle file.

dependencies { compile 'com.android.support:support-v4:18.0.0' compile 'com.google.android.gms:play-services:4.0.30' compile files('libs/FDxSDKProAndroid.jar') } 

The project builds correctly without any error, but onRuntime. I got the following error. How to fix this error?

The error in the next line,

 sgfplib=new JSGFPLib((UsbManager)getSystemService(Context.USB_SERVICE)); 

Error:

 12-04 13:35:13.022 12345-12345/? E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.UnsatisfiedLinkError: Couldn't load jnisgfplib from loader dalvik.system.PathClassLoader[DexPathList[dexElements=[zip file "/data/app/com.mycompany.mytrack-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.mycompany.mytrack-1, /vendor/lib, /system/lib]]]: findLibrary returned null at java.lang.Runtime.loadLibrary(Runtime.java:359) at java.lang.System.loadLibrary(System.java:514) at SecuGen.FDxSDKPro.JSGFPLib.<clinit>(JSGFPLib.java:150) at com.mycompany.mytrack.FingerPrintActivity.onCreate(FingerPrintActivity.java:105) at android.app.Activity.performCreate(Activity.java:5122) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1081) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2270) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2358) at android.app.ActivityThread.access$600(ActivityThread.java:156) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1340) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:153) at android.app.ActivityThread.main(ActivityThread.java:5297) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600) at dalvik.system.NativeStart.main(Native Method) 12-04 13:35:13.033 511-529/? E/AppErrorDialog﹕ Failed to get ILowStorageHandle instance 
+6
source share
4 answers

It looks like it is trying to load the native library, and so far there is no support in Android Gradle for native code. You must double check the documents for your library to confirm this; I tried to find it, but it looks like a commercial library without public documents.

+3
source

You can simply put the .so files in the jniLibs folder in src/main . It was introduced in AS 0.7.2 1

For an example, see this from @CommonsWare or see this page for official samples (scroll to the bottom of the page)

+22
source

There is a way ... but it's a simple hack. U can bind the armeabi folder, inside which there are XXXX.so files.

these are native codes, and @Scott Barta says that support is not supported in Android Gradle for native code.

So let's wrap it like our regular jar files. Step 1: create a folder and name it 'lib' Step 2: take the armeabi> xxxx.so files inside the lib folder. Setp 3: now the zip file is lib and name the zipped file as XXXXX.zip.

Now the project structure will be XXXX.zip-lib-armeabi-xxxx.so

Step 4. Copy the zip file to the libs folder of android studio. Step 5: Rename xxxx.zip to xxxx.jar Step 6: paste the code below depending on the gradle.

dependencies {compile fileTree (dir: 'libs', include: '* .jar')}

Now synchronize Gradle, and then run.

Note. These army men will work only if the processor of the emulator is armeabi. For Intel x86, you may need to create the "x86" folder inside the zip and paste the corresponding .so file into this folder.

It worked for me. try :)

Happy coding.

+2
source

Here is my last hack when I integrated with the same library for a fingerprint device when trying to import .so files into Android Studio 1.5. Error in this line

 sgfplib=new JSGFPLib((UsbManager)getSystemService(Context.USB_SERVICE)); 

The solution was to create a folder named armeabi-v7a in src / main / jniLibs so that the hierarchy was like an attached screenshot.

enter image description here

Hope this helps :) with the latest version of Android Studio 1.5

+2
source

Source: https://habr.com/ru/post/959309/


All Articles