Lib not found error in tesseract [closed]

2019-02-10 05:00发布

问题:

I am working with OCR android. Got samples from googling and work with android tesseract. I have the project as library and refered in another project but, when I run the project it shows the following in Logcat

 07-17 10:38:47.092: ERROR/AndroidRuntime(426): FATAL EXCEPTION: main
    07-17 10:38:47.092: ERROR/AndroidRuntime(426): java.lang.ExceptionInInitializerError
    07-17 10:38:47.092: ERROR/AndroidRuntime(426):     at com.imagetotext.ImagetoText.onCreate(ImagetoText.java:21)
    07-17 10:38:47.092: ERROR/AndroidRuntime(426):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
    07-17 10:38:47.092: ERROR/AndroidRuntime(426):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
    07-17 10:38:47.092: ERROR/AndroidRuntime(426):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
    07-17 10:38:47.092: ERROR/AndroidRuntime(426):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
    07-17 10:38:47.092: ERROR/AndroidRuntime(426):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
    07-17 10:38:47.092: ERROR/AndroidRuntime(426):     at android.os.Handler.dispatchMessage(Handler.java:99)
    07-17 10:38:47.092: ERROR/AndroidRuntime(426):     at android.os.Looper.loop(Looper.java:123)
    07-17 10:38:47.092: ERROR/AndroidRuntime(426):     at android.app.ActivityThread.main(ActivityThread.java:4627)
    07-17 10:38:47.092: ERROR/AndroidRuntime(426):     at java.lang.reflect.Method.invokeNative(Native Method)
    07-17 10:38:47.092: ERROR/AndroidRuntime(426):     at java.lang.reflect.Method.invoke(Method.java:521)
    07-17 10:38:47.092: ERROR/AndroidRuntime(426):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
    07-17 10:38:47.092: ERROR/AndroidRuntime(426):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
    07-17 10:38:47.092: ERROR/AndroidRuntime(426):     at dalvik.system.NativeStart.main(Native Method)
    07-17 10:38:47.092: ERROR/AndroidRuntime(426): Caused by: java.lang.UnsatisfiedLinkError: Library liblept not found
    07-17 10:38:47.092: ERROR/AndroidRuntime(426):     at java.lang.Runtime.loadLibrary(Runtime.java:461)
    07-17 10:38:47.092: ERROR/AndroidRuntime(426):     at java.lang.System.loadLibrary(System.java:557)
    07-17 10:38:47.092: ERROR/AndroidRuntime(426):     at com.googlecode.tesseract.android.TessBaseAPI.<clinit>(TessBaseAPI.java:47)
    07-17 10:38:47.092: ERROR/AndroidRuntime(426):     ... 14 more
    07-17 10:38:47.112: WARN/ActivityManager(60):   Force finishing activity com.imagetotext/.ImagetoText

I think there is something wrong with my android.mk. Please help me fix the error.

回答1:

Exception cause line is,

System.loadLibrary(“lept”);

The problem is liblept.so (shared library) file can not found on specific library path. Without seeing your code just only assumption is your code trying to load shared library liblept.so and the library is not available at that path.

Also the code you are using is either have that liblept.so file in any lib or internal package directory or you have to generate (build) that shared library by using Android-NDK.



回答2:

i have also done same project in my final Year....Use This link which helped me the most... Make OCR using Tesseract

Hope will solve your problem too....



标签: android ocr