HI am working on OCR(Optical Character Recognization) i got a sample project from github.For this project am using tess-test library project and the project builds and executes successfully but whenever the TessBaseAPI is called the app stopped unfortunately..and it shows the following log error
我在OCR(光学字符识别)工作,我得到了github的一个示例项目。对于这个项目,我使用的是测试库项目和项目构建和执行,但是当TessBaseAPI被调用时,这个应用程序就会停止。它显示了下面的日志错误。
12-20 18:27:18.791: E/AndroidRuntime(24466): java.lang.ExceptionInInitializerError
12-20 18:27:18.791: E/AndroidRuntime(24466): at com.datumdroid.android.ocr.simple.SimpleAndroidOCRActivity.onPhotoTaken(SimpleAndroidOCRActivity.java:211)
12-20 18:27:18.791: E/AndroidRuntime(24466): at com.datumdroid.android.ocr.simple.SimpleAndroidOCRActivity.onActivityResult(SimpleAndroidOCRActivity.java:135)
12-20 18:27:18.791: E/AndroidRuntime(24466): at android.app.Activity.dispatchActivityResult(Activity.java:5293)
12-20 18:27:18.791: E/AndroidRuntime(24466): at android.app.ActivityThread.deliverResults(ActivityThread.java:3315)
12-20 18:27:18.791: E/AndroidRuntime(24466): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3362)
12-20 18:27:18.791: E/AndroidRuntime(24466): at android.app.ActivityThread.access$1100(ActivityThread.java:141)
12-20 18:27:18.791: E/AndroidRuntime(24466): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1282)
12-20 18:27:18.791: E/AndroidRuntime(24466): at android.os.Handler.dispatchMessage(Handler.java:99)
12-20 18:27:18.791: E/AndroidRuntime(24466): at android.os.Looper.loop(Looper.java:137)
12-20 18:27:18.791: E/AndroidRuntime(24466): at android.app.ActivityThread.main(ActivityThread.java:5039)
12-20 18:27:18.791: E/AndroidRuntime(24466): at java.lang.reflect.Method.invokeNative(Native Method)
12-20 18:27:18.791: E/AndroidRuntime(24466): at java.lang.reflect.Method.invoke(Method.java:511)
12-20 18:27:18.791: E/AndroidRuntime(24466): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
12-20 18:27:18.791: E/AndroidRuntime(24466): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
12-20 18:27:18.791: E/AndroidRuntime(24466): at dalvik.system.NativeStart.main(Native Method)
12-20 18:27:18.791: E/AndroidRuntime(24466): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load lept from loader dalvik.system.PathClassLoader[dexPath=/data/app/com.datumdroid.android.ocr.simple-1.apk,libraryPath=/data/app-lib/com.datumdroid.android.ocr.simple-1]: findLibrary returned null
12-20 18:27:18.791: E/AndroidRuntime(24466): at java.lang.Runtime.loadLibrary(Runtime.java:365)
12-20 18:27:18.791: E/AndroidRuntime(24466): at java.lang.System.loadLibrary(System.java:535)
12-20 18:27:18.791: E/AndroidRuntime(24466): at com.googlecode.tesseract.android.TessBaseAPI.<clinit>(TessBaseAPI.java:47)
please give solution to my problem am stucked from 5 days it is required in my application.
请给我的问题解决方案,我的申请需要5天的时间。
i googled a lot didn't find any solution.. Thank You
我在谷歌上搜索了很多没有找到解决办法。谢谢你!
4 个解决方案
#1
11
Make sure that the library file "liblept.so" exist either in libs/armeabi or libs/armeabi-v7a, if they exists there, use 7Zip/WinRAR to open the generated APK file and make sure it exists in the APK as well.
确保库文件“liblept”。因此,“存在于libs/armeabi或libs/armeabi-v7a中,如果它们存在,使用7Zip/WinRAR打开生成的APK文件,并确保它也存在于APK中。
#2
0
duplicate of Lib not found error in tesseract
在tesseract中,Lib没有发现错误。
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.
问题是liblept。所以(共享库)文件不能在特定的库路径上找到。没有看到您的代码,只是假设您的代码试图加载共享库liblept。因此,图书馆在这条路上是不可用的。
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.
您所使用的代码也可能有liblept。因此,在任何lib或内部包目录中,或者您必须使用Android-NDK生成(构建)共享库。
#3
0
I am not sure if you found the answer to your problem but mine was from the libs folder in my project being incorrectly named (was lib instead of libs). My issue was a result of accidentally deleting my project and having to restore it by extracting the APK from my phone. Once I renamed the folder, my issue was solved. Hope that helps.
我不确定您是否找到了您的问题的答案,但是我的问题来自于我的项目中的libs文件夹,它被错误地命名了(是lib而不是libs)。我的问题是由于不小心删除了我的项目,并且不得不通过从我的手机提取APK来恢复它。一旦我重新命名了文件夹,我的问题就解决了。希望有帮助。
#4
0
Ppl, After struggling a day.. finally got the solution
在挣扎了一天之后。终于得到了解决
In build.gradle of tess-two module add the below code:
在构建。tess- 2模块的gradle添加以下代码:
sourceSets.main {
manifest.srcFile 'src/main/AndroidManifest.xml'
java.srcDirs = ['src/main/java']
resources.srcDirs = ['src/main/java']
res.srcDirs = ['src/main/res']
jni.srcDirs = []
jniLibs.srcDirs = ['src/main/jniLibs']
}
Main thing is please check manually weather all those file paths specified in above code exists!!
主要问题是,请手动检查以上代码中指定的所有文件路径!!
Coming to this issue, check where "liblept.so" exist in tess-two library. For me it was inside /tesstwo/src/main/jniLibs/armeabi-v7a . Hence i have made jniLibs.srcDirs = ['src/main/jniLibs'] in above code. Hope it helps !!
来看看这个问题,看看“liblept”在哪里。所以“存在于国际象棋库中”。对我来说,它是在/tesstwo/src/main/jniLibs/armeabi-v7a。因此我做了jniLibs。在上面的代码中,srcDirs = ['src/main/jniLibs']。希望它帮助! !
#1
11
Make sure that the library file "liblept.so" exist either in libs/armeabi or libs/armeabi-v7a, if they exists there, use 7Zip/WinRAR to open the generated APK file and make sure it exists in the APK as well.
确保库文件“liblept”。因此,“存在于libs/armeabi或libs/armeabi-v7a中,如果它们存在,使用7Zip/WinRAR打开生成的APK文件,并确保它也存在于APK中。
#2
0
duplicate of Lib not found error in tesseract
在tesseract中,Lib没有发现错误。
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.
问题是liblept。所以(共享库)文件不能在特定的库路径上找到。没有看到您的代码,只是假设您的代码试图加载共享库liblept。因此,图书馆在这条路上是不可用的。
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.
您所使用的代码也可能有liblept。因此,在任何lib或内部包目录中,或者您必须使用Android-NDK生成(构建)共享库。
#3
0
I am not sure if you found the answer to your problem but mine was from the libs folder in my project being incorrectly named (was lib instead of libs). My issue was a result of accidentally deleting my project and having to restore it by extracting the APK from my phone. Once I renamed the folder, my issue was solved. Hope that helps.
我不确定您是否找到了您的问题的答案,但是我的问题来自于我的项目中的libs文件夹,它被错误地命名了(是lib而不是libs)。我的问题是由于不小心删除了我的项目,并且不得不通过从我的手机提取APK来恢复它。一旦我重新命名了文件夹,我的问题就解决了。希望有帮助。
#4
0
Ppl, After struggling a day.. finally got the solution
在挣扎了一天之后。终于得到了解决
In build.gradle of tess-two module add the below code:
在构建。tess- 2模块的gradle添加以下代码:
sourceSets.main {
manifest.srcFile 'src/main/AndroidManifest.xml'
java.srcDirs = ['src/main/java']
resources.srcDirs = ['src/main/java']
res.srcDirs = ['src/main/res']
jni.srcDirs = []
jniLibs.srcDirs = ['src/main/jniLibs']
}
Main thing is please check manually weather all those file paths specified in above code exists!!
主要问题是,请手动检查以上代码中指定的所有文件路径!!
Coming to this issue, check where "liblept.so" exist in tess-two library. For me it was inside /tesstwo/src/main/jniLibs/armeabi-v7a . Hence i have made jniLibs.srcDirs = ['src/main/jniLibs'] in above code. Hope it helps !!
来看看这个问题,看看“liblept”在哪里。所以“存在于国际象棋库中”。对我来说,它是在/tesstwo/src/main/jniLibs/armeabi-v7a。因此我做了jniLibs。在上面的代码中,srcDirs = ['src/main/jniLibs']。希望它帮助! !