当我在真实设备(ZTE,Android 4.2.2)上运行以下代码时,出现错误:
_tessApi = new TessBaseAPI();
_tessApi.setDebug(false);
try {
_tessApi.init(Environment.getExternalStorageDirectory().getPath(), "chi_sim");
_useOcr = true;
} catch (Exception ex) {
_useOcr = false;
}
testRunner 中的错误:
java.lang.UnsatisfiedLinkError: Couldn't load lept from loader dalvik.system.PathClassLoader[DexPathList[[
zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/uiautomator.jar", zip fi
le "/data/local/tmp/AutoRunner.jar"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]]: findLibrary re
turned null
at java.lang.Runtime.loadLibrary(Runtime.java:366)
at java.lang.System.loadLibrary(System.java:514)
at com.googlecode.tesseract.android.TessBaseAPI.<clinit>(TessBaseAPI.java:44)
at com.base.jqhelper.initOCR(jqhelper.java:38)
at com.tieba.AddFriend.Initialization(AddFriend.java:328)
at com.tieba.AddFriend.testRunner(AddFriend.java:43)
at java.lang.reflect.Method.invokeNative(Native Method)
at com.android.uiautomator.testrunner.UiAutomatorTestRunner.start(UiAutomatorTestRunner.java:144)
at com.android.uiautomator.testrunner.UiAutomatorTestRunner.run(UiAutomatorTestRunner.java:87)
at com.android.commands.uiautomator.RunTestCommand.run(RunTestCommand.java:90)
at com.android.commands.uiautomator.Launcher.main(Launcher.java:83)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:235)
at dalvik.system.NativeStart.main(Native Method)
我正在将一个项目打包到 AutoRunner.jar 中并将 jar 推送到真实设备。问题似乎是无法从设备加载 liblept.so 和 libtess.so 文件。