0

我正在使用Tesseract工具开发用于读卡 (OCR) 的示例扫描活动。

它在模拟器上运行良好(使用 android 2.2)并快速轻松地从 sdcard 扫描给定的卡。但是当我在真实设备或模拟器(使用 android 2.1)上尝试它时,会出现以下错误:

10-13 16:48:59.206: DEBUG/dalvikvm(3086): Trying to load lib /data/data/com.scan/lib/liblept.so 0x2fc14960
10-13 16:48:59.196: DEBUG/SntpClient(1814): request time failed: java.net.UnknownHostException: xtra1.gpsonextra.net
10-13 16:48:59.206: DEBUG/dalvikvm(3086): Trying to load lib /data/data/com.scan/lib/liblept.so 0x2fc14960
10-13 16:48:59.236: INFO/dalvikvm(3086): Unable to dlopen(/data/data/com.scan/lib/liblept.so): Cannot load library: link_image[1829]:  1137 could not load needed library 'libjpeg.so' for 'liblept.so' (load_library[1137]: Library 'libjpeg.so' not found)
10-13 16:48:59.236: WARN/dalvikvm(3086): Exception Ljava/lang/UnsatisfiedLinkError; thrown during Lcom/googlecode/tesseract/android/TessBaseAPI;.<clinit>
10-13 16:48:59.236: DEBUG/AndroidRuntime(3086): Shutting down VM
10-13 16:48:59.236: WARN/dalvikvm(3086): threadid=3: thread exiting with uncaught exception (group=0x2aaca450)
10-13 16:48:59.236: INFO/dalvikvm(3086): Unable to dlopen(/data/data/com.scan/lib/liblept.so): Cannot load library: link_image[1829]:  1137 could not load needed library 'libjpeg.so' for 'liblept.so' (load_library[1137]: Library 'libjpeg.so' not found)
10-13 16:48:59.236: WARN/dalvikvm(3086): Exception Ljava/lang/UnsatisfiedLinkError; thrown during Lcom/googlecode/tesseract/android/TessBaseAPI;.<clinit>
10-13 16:48:59.236: DEBUG/AndroidRuntime(3086): Shutting down VM
10-13 16:48:59.236: WARN/dalvikvm(3086): threadid=3: thread exiting with uncaught exception (group=0x2aaca450)
10-13 16:48:59.246: ERROR/AndroidRuntime(3086): Uncaught handler: thread main exiting due to uncaught exception
10-13 16:48:59.246: ERROR/AndroidRuntime(3086): Uncaught handler: thread main exiting due to uncaught exception
10-13 16:48:59.256: ERROR/AndroidRuntime(3086): java.lang.ExceptionInInitializerError
10-13 16:48:59.256: ERROR/AndroidRuntime(3086):     at com.scan.SAMPLE_SCANActivity.onCreate(SAMPLE_SCANActivity.java:37)
10-13 16:48:59.256: ERROR/AndroidRuntime(3086):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
10-13 16:48:59.256: ERROR/AndroidRuntime(3086):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
10-13 16:48:59.256: ERROR/AndroidRuntime(3086):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
10-13 16:48:59.256: ERROR/AndroidRuntime(3086):     at android.app.ActivityThread.access$2200(ActivityThread.java:119)
10-13 16:48:59.256: ERROR/AndroidRuntime(3086):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
10-13 16:48:59.256: ERROR/AndroidRuntime(3086):     at android.os.Handler.dispatchMessage(Handler.java:99)
10-13 16:48:59.256: ERROR/AndroidRuntime(3086):     at android.os.Looper.loop(Looper.java:123)
10-13 16:48:59.256: ERROR/AndroidRuntime(3086):     at android.app.ActivityThread.main(ActivityThread.java:4363)
10-13 16:48:59.256: ERROR/AndroidRuntime(3086):     at java.lang.reflect.Method.invokeNative(Native Method)
10-13 16:48:59.256: ERROR/AndroidRuntime(3086):     at java.lang.reflect.Method.invoke(Method.java:521)
10-13 16:48:59.256: ERROR/AndroidRuntime(3086):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:877)
10-13 16:48:59.256: ERROR/AndroidRuntime(3086):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:635)
10-13 16:48:59.256: ERROR/AndroidRuntime(3086):     at dalvik.system.NativeStart.main(Native Method)
10-13 16:48:59.256: ERROR/AndroidRuntime(3086): Caused by: java.lang.UnsatisfiedLinkError: Library lept not found
10-13 16:48:59.256: ERROR/AndroidRuntime(3086):     at java.lang.Runtime.loadLibrary(Runtime.java:489)
10-13 16:48:59.256: ERROR/AndroidRuntime(3086):     at java.lang.System.loadLibrary(System.java:557)
10-13 16:48:59.256: ERROR/AndroidRuntime(3086):     at com.googlecode.tesseract.android.TessBaseAPI.<clinit>(TessBaseAPI.java:42)
10-13 16:48:59.256: ERROR/AndroidRuntime(3086):     ... 14 more
10-13 16:48:59.256: ERROR/AndroidRuntime(3086): java.lang.ExceptionInInitializerError
10-13 16:48:59.256: ERROR/AndroidRuntime(3086):     at com.scan.SAMPLE_SCANActivity.onCreate(SAMPLE_SCANActivity.java:37)
10-13 16:48:59.256: ERROR/AndroidRuntime(3086):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
10-13 16:48:59.256: ERROR/AndroidRuntime(3086):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
10-13 16:48:59.256: ERROR/AndroidRuntime(3086):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
10-13 16:48:59.256: ERROR/AndroidRuntime(3086):     at android.app.ActivityThread.access$2200(ActivityThread.java:119)
10-13 16:48:59.256: ERROR/AndroidRuntime(3086):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
10-13 16:48:59.256: ERROR/AndroidRuntime(3086):     at android.os.Handler.dispatchMessage(Handler.java:99)
10-13 16:48:59.256: ERROR/AndroidRuntime(3086):     at android.os.Looper.loop(Looper.java:123)
10-13 16:48:59.256: ERROR/AndroidRuntime(3086):     at android.app.ActivityThread.main(ActivityThread.java:4363)
10-13 16:48:59.256: ERROR/AndroidRuntime(3086):     at java.lang.reflect.Method.invokeNative(Native Method)
10-13 16:48:59.256: ERROR/AndroidRuntime(3086):     at java.lang.reflect.Method.invoke(Method.java:521)
10-13 16:48:59.256: ERROR/AndroidRuntime(3086):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:877)
10-13 16:48:59.256: ERROR/AndroidRuntime(3086):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:635)
10-13 16:48:59.256: ERROR/AndroidRuntime(3086):     at dalvik.system.NativeStart.main(Native Method)
10-13 16:48:59.256: ERROR/AndroidRuntime(3086): Caused by: java.lang.UnsatisfiedLinkError: Library lept not found
10-13 16:48:59.256: ERROR/AndroidRuntime(3086):     at java.lang.Runtime.loadLibrary(Runtime.java:489)
10-13 16:48:59.256: ERROR/AndroidRuntime(3086):     at java.lang.System.loadLibrary(System.java:557)
10-13 16:48:59.256: ERROR/AndroidRuntime(3086):     at com.googlecode.tesseract.android.TessBaseAPI.<clinit>(TessBaseAPI.java:42)
10-13 16:48:59.256: ERROR/AndroidRuntime(3086):     ... 14 more

这个库是否适用于 android 2.1 或任何其他问题???

4

3 回答 3

2

首先,您阅读了所有步骤:-

对于 Windows 或 Ubuntu 并构建 Android 2.2 应用程序:

  1. 下载带有 README 的 ndk 和 tesseract 工具 (svn) 项目

  2. 使用 ndk 在 debian(vmware) 上构建它

  3. tesseract 工具实际上是一个库,并且有一个 eclipse .project 所以只需在使用 ndk 构建 so 并构建它之后导入该项目。

  4. 将其设置为 lib:http: //developer.android.com/guide/developing/projects/projects-eclipse.html#SettingUpLibraryProject

  5. 现在在同一个工作区中创建一个新的 android 项目,即您的应用程序。转到属性并从第 3 步引用库(http://developer.android.com/guide/developing/projects/projects-eclipse.html#ReferencingLibraryProject)

6. 基于 Android 2.2(分钟)构建您的应用程序:http ://code.google.com/p/tesseract-android-tools/issues/detail?id=5#c16

所以这个库不适用于 android 2.1

这个库是否适用于 android 2.1 ??? .

于 2011-10-19T04:57:43.573 回答
1

我正在为 OCR 开发纯 Java 替代方案:

http://sourceforge.net/projects/javaocr/?_test=beta

也许这可能是你的替代品。

于 2011-10-24T09:03:50.067 回答
0

不,这个原生库不支持低于 Android 版本 2.2,因为谷歌也在线提供这个服务来克服这个

于 2011-10-19T15:53:48.987 回答