android - 无法从 Android 中的终端更新项目

标签 android terminal android-ndk ocr tess-two

我正在开发一个 Android 项目。在我的项目中,我需要做 OCR。于是找到了这个教程http://www.codeproject.com/Tips/840623/Android-Character-Recognition .我正在尝试按照该教程进行操作。但是我在设置时遇到问题,尤其是从终端(tess-two 文件夹)更新项目时。看看我在下面做了什么。

  1. 我从这个链接下载了 tess-two

    https://github.com/rmtheis/tess-two/

  2. 然后我安装了 android NDK 来构建那个项目

  3. 我在PATH下设置了环境变量
  4. 然后我从终端在 tess two 文件夹中运行下面的命令

    ndk-build //this took around 30 minutes. I closed command windows after successful built
    
  5. 然后我运行这个命令

    android update project --path C:\tess-two-master\tess-two
    

当我运行该命令时问题就开始了,因为我无法从终端运行 android 命令。所以我从 Stack Overflow 找到了解决方案。我需要在 PATH 下设置 ANDROID_HOME 和环境变量。然后我测试了“android”命令,它正在运行。

  1. 然后我再次运行这个命令

    android update project --path C:\tess-two-master\tess-two
    

这一次,它给我这个错误

enter image description here

如何解决这个错误?为什么我的更新命令不起作用?我的代码有什么问题?我使用的是 Windows 64 操作系统。

这是另一种方式。使用 Grandle 安装

我尝试了另一种安装 tess-two 的方法。我根据文档像这样使用 Gradle 安装。但是我无法访问 TessDataManager,因为在项目中找不到它。

Gradle

dependencies {
    compile 'com.rmtheis:tess-two:6.0.2'
}

这是错误

enter image description here

如您所见,我无法访问 TessDataManager 类。如何导入该类?

最佳答案

tess-two 项目已更新为包括一个预编译的 AAR,它可以是 incorporated into your app通过编辑您应用的 build.gradle 文件。

这意味着你可以跳过自己导入/编译库的步骤,按照tess-two项目上的使用说明进行操作。按照使用说明进行操作后,您将能够直接从您的项目中引用 tess-two 类(包括 TessBaseAPI 类)。

关于android - 无法从 Android 中的终端更新项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38040925/

相关文章:

android - ProgressDialog 圆圈未在设备中显示

python - 如何在 python 中使用 mac 的语音识别

python - 苹果系统; Python3; FileNotFoundError : [Errno 2] No such file or directory: '' . 如何修复?

java - 在 Mac 上使用 JRE 打开 jar 文件

android - 如何绘制/渲染 Bullet Physics 碰撞体/形状?

android - Android LicenseChecker 上“无法绑定(bind)到服务”

android - 错误。 LiveLiteralKt 未找到!在事件日志中

android - 如果模型的属性是私有(private)的,则 Retrofit Android 无法将 JSON 响应转换为模型

android - JNI 与安卓?

Android NDK 套接字 connect() 在 3g 上失败时返回 0