Including * .so Android Studio tess-two library (tesseract)

I am trying to incorporate Tesseract libraries into my Android project today.

From what I found, I did the following:

1) Download tess-two from gooogle git, 2) build with NDK 3) put * .so files (armeabi / v7, x86, mips) in / app / main / jniLibs /, 4) pack * .so in a .jar file , put the archive in app / libs / and write the dependency {} on it in the gradle.build file

I use Android Studio, and when I write TessBaseAPI and press Alt + Enter → "add dependency to tess-two module", it automatically writes the import line:

import com.googlecode.tesseract.android.TessBaseAPI;

But when I try to build it, I get

Error: com.googlecode.tesseract.android package does not exist

I am using Android Studio 1.1

+5
source share
1 answer

If someone wonders, obviously the dependency on alt + enter does not do it right.

First, he needed to build the whole project. So I added a folder:

  • include ': libraries: tess-two'

in gradle settings, moving the entire project of the tess-two structure to 'libraries / tess-two' (when the "libraries" are at the same level as your "app" folder).

After that (if you configured ndk.dir = C: path in local.properties), you can set the module dependency in your main project ...

Rightclick app-> Open the module options (or F4) and click the plus button on the right side and add the tess-two module to your project application.

enter image description here

Note that the 'tess-two' folder must contain its own build.gradle file (manifestfile and project.properties file) so that it can build itself.

Hope this helps someone :)

+9
source

All Articles