我必须在Android Studio中使用tesseract-ocr但我收到错误。
04-10 22:04:56.885 17764-17764/com.example.samsung.bitirme_deneme3 V/Tesseract(native): Java_com_googlecode_tesseract_android_TessBaseAPI_nativeClassInit
04-10 22:04:56.885 17764-17764/com.example.samsung.bitirme_deneme3 W/dalvikvm: Exception Ljava/lang/NoSuchFieldError; thrown while initializing Lcom/googlecode/tesseract/android/TessBaseAPI;
04-10 22:04:56.885 17764-17764/com.example.samsung.bitirme_deneme3 W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x41b25a08)
04-10 22:04:56.915 17764-17764/com.example.samsung.bitirme_deneme3 E/AndroidRuntime: FATAL EXCEPTION: main
04-10 22:04:56.915 17764-17764/com.example.samsung.bitirme_deneme3 E/AndroidRuntime: java.lang.ExceptionInInitializerError
04-10 22:04:56.915 17764-17764/com.example.samsung.bitirme_deneme3 E/AndroidRuntime: at com.example.samsung.bitirme_deneme3.MainActivity$1.onClick(MainActivity.java:555)
04-10 22:04:56.915 17764-17764/com.example.samsung.bitirme_deneme3 E/AndroidRuntime: at android.view.View.performClick(View.java:4231)
04-10 22:04:56.915 17764-17764/com.example.samsung.bitirme_deneme3 E/AndroidRuntime: at android.view.View$PerformClick.run(View.java:17537)
04-10 22:04:56.915 17764-17764/com.example.samsung.bitirme_deneme3 E/AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:725)
04-10 22:04:56.915 17764-17764/com.example.samsung.bitirme_deneme3 E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:92)
04-10 22:04:56.915 17764-17764/com.example.samsung.bitirme_deneme3 E/AndroidRuntime: at android.os.Looper.loop(Looper.java:158)
04-10 22:04:56.915 17764-17764/com.example.samsung.bitirme_deneme3 E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5751)
04-10 22:04:56.915 17764-17764/com.example.samsung.bitirme_deneme3 E/AndroidRuntime: at java.lang.reflect.Method.invokeNative(Native Method)
04-10 22:04:56.915 17764-17764/com.example.samsung.bitirme_deneme3 E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:511)
04-10 22:04:56.915 17764-17764/com.example.samsung.bitirme_deneme3 E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1083)
04-10 22:04:56.915 17764-17764/com.example.samsung.bitirme_deneme3 E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:850)
04-10 22:04:56.915 17764-17764/com.example.samsung.bitirme_deneme3 E/AndroidRuntime: at dalvik.system.NativeStart.main(Native Method)
04-10 22:04:56.915 17764-17764/com.example.samsung.bitirme_deneme3 E/AndroidRuntime: Caused by: java.lang.NoSuchFieldError: no field with name='mNativeData' signature='I' in class Lcom/googlecode/tesseract/android/TessBaseAPI;
04-10 22:04:56.915 17764-17764/com.example.samsung.bitirme_deneme3 E/AndroidRuntime: at com.googlecode.tesseract.android.TessBaseAPI.nativeClassInit(Native Method)
04-10 22:04:56.915 17764-17764/com.example.samsung.bitirme_deneme3 E/AndroidRuntime: at com.googlecode.tesseract.android.TessBaseAPI.<clinit>(TessBaseAPI.java:47)
04-10 22:04:56.915 17764-17764/com.example.samsung.bitirme_deneme3 E/AndroidRuntime: at com.example.samsung.bitirme_deneme3.MainActivity$1.onClick(MainActivity.java:555)
04-10 22:04:56.915 17764-17764/com.example.samsung.bitirme_deneme3 E/AndroidRuntime: at android.view.View.performClick(View.java:4231)
04-10 22:04:56.915 17764-17764/com.example.samsung.bitirme_deneme3 E/AndroidRuntime: at android.view.View$PerformClick.run(View.java:17537)
04-10 22:04:56.915 17764-17764/com.example.samsung.bitirme_deneme3 E/AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:725)
04-10 22:04:56.915 17764-17764/com.example.samsung.bitirme_deneme3 E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:92)
04-10 22:04:56.915 17764-17764/com.example.samsung.bitirme_deneme3 E/AndroidRuntime: at android.os.Looper.loop(Looper.java:158)
04-10 22:04:56.915 17764-17764/com.example.samsung.bitirme_deneme3 E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5751)
04-10 22:04:56.915 17764-17764/com.example.samsung.bitirme_deneme3 E/AndroidRuntime: at java.lang.reflect.Method.invokeNative(Native Method)
04-10 22:04:56.915 17764-17764/com.example.samsung.bitirme_deneme3 E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:511)
04-10 22:04:56.915 17764-17764/com.example.samsung.bitirme_deneme3 E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1083)
04-10 22:04:56.915 17764-17764/com.example.samsung.bitirme_deneme3 E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:850)
04-10 22:04:56.915 17764-17764/com.example.samsung.bitirme_deneme3 E/AndroidRuntime: at dalvik.system.NativeStart.main(Native Method)
TessBaseAPI.java中的第47行: nativeClassInit();
在TessBaseAPI.java类中,当我遇到nativeClassInit()函数时,似乎出现错误:*
无法解析相应的JNI功能 Java_com_googlecode_tesseract_android_TessBaseAPI_nativeClassInit(),
报告Java中的本机方法声明,其中没有相应的JNI 功能在项目中找到。
*
但是函数“nativeClassInit()”在tessbaseapi.cpp中定义:
空隙 Java_com_googlecode_tesseract_android_TessBaseAPI_nativeClassInit(JNIEnv的* ENV, jclass clazz){
field_mNativeData = env-&gt; GetFieldID(clazz,“mNativeData”,“J”);
method_onProgressValues = env-&gt; GetMethodID(clazz,“onProgressValues”, “(IIIIIIIII)V”); }
我找到了一些解决方案,但问题没有解决。谢谢你的帮助。