0

I was digging on using android tesseract api in my project.

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

I copied com_googlecode_leptonica_android and com_googlecode_tesseract_android directory from tess-two to my project jni directory, my jni folder structure:

Android.mk
Application.mk
com_googlecode_leptonica_android
com_googlecode_tesseract_android
main_jni.cpp
...other h and cpp files...

I'm not sure how to include the Android.mk files in com_googlecode_leptonica_android and com_googlecode_tesseract_android inside my Android.mk file in jni directory.

LOCAL_PATH := $(call my-dir)
TESSERACT_PATH := $(LOCAL_PATH)/com_googlecode_tesseract_android/src
LEPTONICA_PATH := $(LOCAL_PATH)/com_googlecode_leptonica_android/src
include $(call all-subdir-makefiles)
include $(CLEAR_VARS)
$(info $(NDK_MODULE_PATH))
LOCAL_CFLAGS :=  -Wno-psabi
LOCAL_LDLIBS += -L$(SYSROOT)/usr/lib -llog
LOCAL_STATIC_LIBRARIES += android_native_app_glue
FILE_LIST_CPP := $(wildcard $(LOCAL_PATH)/*.cpp) # finds all cpp files
LOCAL_SRC_FILES := $(FILE_LIST_CPP:$(LOCAL_PATH)/%=%)
LOCAL_CFLAGS += \
    -DDEBUG \
    -DDEFAULT_DIR=\"/default\"
LOCAL_MODULE    := MyModule

include $(BUILD_SHARED_LIBRARY)

which does not work.

How to get this work?

Jun
  • 3,422
  • 3
  • 28
  • 58
  • Why not build using the regular build [instructions](https://github.com/rmtheis/tess-two#build) and import as a library project as suggested? – rmtheis Jun 01 '14 at 00:47
  • I wanted to use my existing project and jni, and want to include tesseract libraries there. I'm using tesseract modules in my jni and not sure how to include them in Android.mk – Jun Jun 01 '14 at 03:37
  • @rmtheis Can I export the tess-two project to jar file and use that in my project? – Jun Jun 01 '14 at 09:35
  • I don't think it will work as a jar. – rmtheis Jun 01 '14 at 13:24
  • @rmtheis How can I use tesseract methods in jni method? – Jun Jun 03 '14 at 11:07
  • An example: [https://github.com/…](https://github.com/renard314/textfairy/blob/master/textfairy/jni/ocr/ocr.cpp) – rmtheis Jun 05 '14 at 02:45

1 Answers1

1

I couldn't compile Android.mk files in tess-two project, I just ended up with importing libtess.so and liblept.so files into my Android.mk as prebuilt library and I could use tesseract libraries in my jni file.

Jun
  • 3,422
  • 3
  • 28
  • 58