使用 NDK 构建 google tesseract 以便在 android studio 中使用

Building google tesseract with NDK for using in android studio

我正在尝试使用 google tesseract 制作一个简单的 OCR 应用程序。为此,我正在关注这个 tutorial。但是 运行 ant release 命令,我收到一个错误。错误信息是这样的:

Buildfile: C:\Users\Pial-PC\Desktop\tesseract\eyes-two\build.xml

BUILD FAILED C:\Users\Pial-PC\Desktop\tesseract\eyes-two\build.xml:46: sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var

Total time: 1 second

我的问题是如何解决这个问题? ant release 是否真的需要构建 tesseract 才能在 android studio 中使用它?

看起来你没有 运行 android update project --path . 生成 local.properties 文件。

但是有一个更简单的方法 -- 从最近的更新开始,您可以按照 instructions 将 OCR 引擎作为 pre-compiled 二进制文件包含在您的应用程序中。要使用当前版本,请添加

compile 'com.rmtheis:tess-two:5.4.0'

到您应用 app/build.gradledependencies 部分。