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

不问归期 提交于 2019-11-29 15:09:23

问题


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


回答1:


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.

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 :)



来源:https://stackoverflow.com/questions/29759959/including-so-libraries-android-studio-tess-two-tesseract

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!