java.lang.UnsatisfiedLinkError: Couldn't load

2019-04-05 06:59发布

问题:

I am using sqlcipher.jar for encrypting database in android and also using it's native library in

libs/armeabi folder

1)libdatabase_sqlcipher.so

2)libsqlcipher_android.so

3)libstlport_shared.so

and

libs/x86 folder

1)libdatabase_sqlcipher.so

2)libsqlcipher_android.so

3)libstlport_shared.so

and jar file named sqlcipher.jar in libs/ folder all i have imported

now every thing is working fine it's going good database is fetching and reading from sqlite is also working fine and also i am not getting any kind of error in SQLiteDatabase.loadLibs(context); line

but i want to implement also OCR in my project to do that i am importing project named tess-two from this http://code.google.com/p/tesseract-ocr/ and https://github.com/rmtheis/tess-two in that there is a library named tess-two folder

and i am importing that project library into my android project and i cleaned my project and run it at that time i got the error in line SQLiteDatabase.loadLibs(context);

again when i removed tess-two library and doing uninstall from device and doing clean and build and run it's working fine no error is occurring, i want OCR functionality also in my project can anybody help me

回答1:

I had same issue.. I was using Android Studio and I had imported application from eclipse to android studio.

I spent 3-4 hours to find out the solution. Here what I did to solve this issue.. (Only for Android studio) Create Directory into src folder name it main and other directory as per following image. You may have libs and assets folder outside of src folder, in main directory of project, that is eclipse structure. We will need to follow Android Studio's structure..

For more details.. Check this link...

For other helps regarding SqlCipher check this link..

(I know I am bit late to answer this question but it might help someone.)



回答2:

I was running into the same issue. First of all, check that all the libraries are correctly imported.

In my case the problem was that when we added another library project, these project had a armeabi_v7 folder, so apparently if will take precedence over the armeabi folder, meaning that the sqlitecypher libraries won't be located.

In our case the solution was just to remove the armeabi_v7 folder on the new library.

Hope it helps.



回答3:

You can try to change the line:

APP_STL := gnustl_static (in the file tess-two / tess-two / jni / Application.mk)

to: APP_STL := stlport_static



回答4:

The loader is not able to find the said library file. So, I decided to pack it along with my app. It's only 394KB

I downloaded the libstlport_shared.so from the following address and added it to the lib/armeabi and lib/armeabi-v7a folders, cleaned the project and rebuilt it. Now it runs without a problem.

http://331312256.wodemo.net/browse/dl/156348/lib/armeabi/libstlport_shared.so?resolved=1

Hope that helps