0

I tried to rebuild an android app wich contains tess-two as library. When using as is, I get this error

java.lang.NoSuchFieldError: no field with name='mNativeData' signature='I' in class Lcom/googlecode/tesseract/android/TessBaseAPI;

When reverting commit bc931c966f5a05745bd4be5833f551643589982d (private long mNativeData; changed to private int mNativeData;)

It then works. It might be related to my CPU/ABI.

I'm really not an android nor ndk expert, but this sounds as a bug to me. Should the cpp code not return a long, or the TessBaseAPI.java be adapted to recieve either a int or a long.

Thanks

Mensoif
  • 13
  • 6
  • I'm not clear on why your code expects an `int`. Maybe it's been modified? – rmtheis May 23 '15 at 15:12
  • I checked out the code directly from your git, so I don't think it has been modified. But maybe its another part of the code that's breaks, but as mNativeData is private and not used in another part of the code, I belived that the problem was is tess-two, but maybe I was wrong. – Mensoif May 23 '15 at 16:03
  • Are you using the "Cordova plugin"? – rmtheis May 23 '15 at 16:20
  • It would be great if you could open an issue on the tess-two project and explain exactly how to reproduce the problem, including which version of the NDK you're using and what platform you're compiling on. – rmtheis May 23 '15 at 16:28

1 Answers1

1

In the commit you're referring to, that field was changed to be a "long" in both the Java and JNI code in order to support 64-bit devices.

It should be left as a "long" across the board.

If you're using a project that uses a precompiled version of tess.so, you can roll back the tess-two code to an older version that predates the commit that causes the conflict, for example:

git checkout 69b73ef5952c91b4d5d238f76a027a295f58575d

Alternately, you could build new versions of the *.so files using the tess-two build instructions and replace those files in your project.

rmtheis
  • 5,992
  • 12
  • 61
  • 78