Search code examples
androidterminalandroid-ndkocrtess-two

Cannot update project from terminal in Android


I am developing an Android project. In my project, I need to do OCR. So found this tutorial http://www.codeproject.com/Tips/840623/Android-Character-Recognition. I am trying to follow that tutorial. But I am having problems with set up, especially with updating project from terminal (tess-two folder). See what I have done below.

  1. I downloaded tess-two from this link

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

  2. Then I installed android NDK to build that project

  3. I set environment variable under PATH
  4. Then I run below command in tess two folder from terminal

    ndk-build //this took around 30 minutes. I closed command windows after successful built
    
  5. Then I run this command

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

The problem starts when I run that command because I cannot run android command from terminal. So I found solution from Stack Overflow. I needed to set ANDROID_HOME and environments variable under PATH. Then I tested "android" command and it is working.

  1. Then I run this command again

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

This time, it is giving me this error

enter image description here

How can I solve this error? Why my update command is not working? What is wrong with my code? I am using Windows 64 OS.

This is another way. Installing using Grandle

I tried another way to install tess-two. I installed using Gradle like this according to documentation. But I cannot access to TessDataManager because it cannot be found in project.

Gradle

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

This is error

enter image description here

As you can see, I cannot access to TessDataManager class. How can I import that class?


Solution

  • The tess-two project has been updated to include a pre-compliled AAR that can be incorporated into your app by editing your app's build.gradle file.

    This means that you can skip the steps of importing/compiling the library yourself, and follow the usage instructions on the tess-two project. After following the usage instructions, you'll be able to refer to the tess-two classes -- including the TessBaseAPI class -- directly from your project.