Search code examples
javaandroidtesseract

no such static field: 'sCompatibilityDone'


I am trying to compile tesseract with my android application.

The problem I am facing is when I am trying to initialize I am getting error.

During debug time I am seeing the message "no such static field: 'sCompatibilityDone'" This message is showing when it is executing View.java

After full execution I am getting an error, described below:

01-04 14:40:54.840    4010-4010/com.example.my_project E/﹕ 
file /data/data/com.nvidia.NvCPLSvc/files/driverlist.txt: not found!

The code that is creating the error is as below:

Bitmap bitmap= BitmapFactory.decodeResource(getResources(), R.drawable.test_img);
    TessBaseAPI tessBaseAPI=new TessBaseAPI();
    tessBaseAPI.init(OCR_RUNTIME_DIRECTORY, "jpn");

    tessBaseAPI.setImage(bitmap);

    String recText=tessBaseAPI.getUTF8Text();
    Dialog.Show(this, recText);

The error is being generated on line 3.
Some definition: OCR_RUNTIME_DIRECTORY="/.../datafile/"
Dialog is a class to do some action in short effort.

Thank you! in advance.


Solution

  • Solved the issue.

    There was two mistake.

    1. I was casting view to ImageView. That is why I was getting static member missing issue.

    2. ocr directory must have to contain 'tessdata' directory. It was in the message. But I missed it completely.

    Anyway, error is fixed but ocr result is, very much, incorrect. Will have to go through some reading I guess.