I am following the tutorial from this tesseract tutorial and had everything go smoothly up until my actual running of the Java code. When I try
new TessBaseApi();
It throws the following error
Error Code: 2
Output:
In file included from tesstwo/src/main/jni/com_googlecode_leptonica_android/box.cpp:17:0:
tesstwo/src/main/jni/com_googlecode_leptonica_android/common.h:22:24: fatal error: allheaders.h: No such file or directory
#include <allheaders.h>
^
compilation terminated.
make: ***
I have looked into /jni/com_googlecode_leptonica_android/src/src
and find the allheaders.h
file there. I have a feeling my paths are wrong, but I've tried almost everything and no avail. What's the issue?
This works for me: https://coderwall.com/p/eurvaq/tesseract-with-andoird-and-gradle
But do not delete libs directory!
Set compileSdkVersion
, buildToolsVersion
, minSdkVersion
and targetSdkVersio
to the same values as in project buil.gradle
I also change classpath 'com.android.tools.build:gradle:0.9.+'
to classpath 'com.android.tools.build:gradle:1.0.+'
I also ran into this problem with Android Studio. After googling some more i found this issue. https://code.google.com/p/android/issues/detail?id=74132
Apparently the NDK plugin generates it's own Android.mk file and ignore any existing one, so the recommended way is to run ndk-build to generate the native .so files.
When I used ndk-build in the tess-two directory it compiles just fine and the .so files is created.
How you can include native libraries in gradle and android studio is described in this post: Add pre-built .so files in project using Android Gradle plugin 0.7.3
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With