Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I have been trying to include Tesseract libraries into my Android project today.

From what I have found I did following:

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

I'm using Android Studio and when I write TessBaseAPI and hit Alt+Enter -> "add dependency to tess-two module" it automaticaly write import row:

import com.googlecode.tesseract.android.TessBaseAPI;

But then when I try to build it I'm getting

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

I'm using Android Studio 1.1

like image 461
Tomáš John Avatar asked Feb 10 '23 09:02

Tomáš John


1 Answers

If somebody would wondering, obviously dependency from alt+enter didn't make it right.

It had to build whole project itself first. So I added a folder:

  • include ':libraries:tess-two'

into the gradle.settings, moving whole project of tess-two structure into 'libraries/tess-two' (when 'libraries' is same level as your 'app' folder).

After that (if you have set up ndk.dir=C:path in local.properties) , you are able to set module dependency into your main project...

Rightclick app->Open Module Settings(or F4) and click plus on right side and add tess-two as module in your project app.

enter image description here

Notice that 'tess-two' folder has to contains own build.gradle (manifestfile and project.properties) file, so it can build itself.

Hope it will helps somebody :)

like image 183
Tomáš John Avatar answered Feb 15 '23 10:02

Tomáš John