0

I am trying to make an simple OCR app using google tesseract. For this purpose, i am following this tutorial. But running ant release command, i am getting an error. The error message is like this:

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

My question is how can i remove this problem? Is ant release actually needed to build tesseract in order to use it in android studio ?

Pial Kanti
  • 1,550
  • 2
  • 13
  • 26

1 Answers1

1

Looks like you didn't run android update project --path . to generate the local.properties file.

But there's an easier way-- as of a recent update, you can follow the instructions to include the OCR engine in your app as a pre-compiled binary. To use the current version, add

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

to the dependencies section of your app's app/build.gradle.

rmtheis
  • 5,992
  • 12
  • 61
  • 78
  • after adding this to the dependencies section of my app's **build.gradle** can i call the api like this [tutorial](http://www.codeproject.com/Articles/840623/Android-Character-Recognition) explained in **Code Project** ? – Pial Kanti Jan 16 '16 at 17:16
  • Yes. The path for init() in the tutorial is wrong though -- see [here](http://stackoverflow.com/a/12880105/667810) for the correct way to format the path parameter there. – rmtheis Jan 16 '16 at 17:23
  • In **GitHub** link says that **A v3.02+ trained data file for a language. Data files must be extracted to the Android device in a subdirectory named tessdata.** Where i will make the tessdata subdirectory in android studio? Or while grade was building,trained data files were downloaded too? – Pial Kanti Jan 16 '16 at 17:28
  • You need to manually download the trained data, and install those files on your device manually, or add code to your app to install them programmatically. [Save](http://developer.android.com/guide/topics/data/data-storage.html#filesExternal) to app-private external storage. – rmtheis Jan 16 '16 at 17:33