我已下载tess-two,然后我已将该位置全部导入我的项目。编译* .so文件并尝试在我的手机上运行:
TessBaseAPI baseApi = new TessBaseAPI();
baseApi.setDebug(true);
baseApi.init(DATA_PATH, lang);
baseApi.setImage(bitmap);
String recognizedText = baseApi.getUTF8Text();
baseApi.end();
但结果很难过:
02-06 15:43:32.095 4072-4072/my.package.name E/AndroidRuntime? FATAL EXCEPTION: main
Process: my.package.name, PID: 4072
java.lang.UnsatisfiedLinkError: Native method not found: my.package.name.tesseract.android.TessBaseAPI.nativeClassInit:()V
at my.package.name.tesseract.android.TessBaseAPI.nativeClassInit(Native Method)
at my.package.name.tesseract.android.TessBaseAPI.<clinit>(TessBaseAPI.java:46)
at my.package.name.activities.SimpleAndroidOCRActivity.onPhotoTaken(SimpleAndroidOCRActivity.java:214)
at my.package.name.activities.SimpleAndroidOCRActivity.onActivityResult(SimpleAndroidOCRActivity.java:138)
at android.app.Activity.dispatchActivityResult(Activity.java:5441)
at android.app.ActivityThread.deliverResults(ActivityThread.java:3353)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3400)
at android.app.ActivityThread.access$1300(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1250)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5047)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:806)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622)
at dalvik.system.NativeStart.main(Native Method)
任何人都可以帮我解决这个问题吗?
答案 0 :(得分:0)
您好我认为您没有编译匹配所有cpu的* .so文件。
请编辑Application.mk,如下所示
APP_STL:= gnustl_static
APP_ABI:= armeabi armeabi-v7a x86 mips arm64-v8a x86_64 mips64
APP_OPTIM:=发布
APP_PLATFORM:= android-9
APP_CPPFLAGS + = -fexceptions -frtti
NDK_TOOLCHAIN_VERSION:=铿锵
然后编译最好的问候