包括 *.so 库 Android Studio tess-two (tesseract) [英] Including *.so libraries Android Studio tess-two (tesseract)

查看:44
本文介绍了包括 *.so 库 Android Studio tess-two (tesseract)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我今天一直在尝试将 Tesseract 库包含到我的 Android 项目中.

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

根据我的发现,我做了以下事情:

From what I have found I did following:

1) 从谷歌 git 下载 tess-2,2) 使用 NDK 构建3) 将 *.so 文件 (armeabi/v7,x86,mips) 放入/app/main/jniLibs/,4) 将 *.so 打包成 .jar 文件,将归档文件放入 app/libs/并在 gradle.build 文件中写入依赖项 {}

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

我正在使用 Android Studio,当我编写 TessBaseAPI 并点击 Alt+Enter ->将依赖项添加到 tess-two 模块"时,它会自动写入导入行:

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:

导入 com.googlecode.tesseract.android.TessBaseAPI;

import com.googlecode.tesseract.android.TessBaseAPI;

但是当我尝试构建它时,我得到了

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

错误:com.googlecode.tesseract.android 包不存在

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

我使用的是 Android Studio 1.1

I'm using Android Studio 1.1

推荐答案

如果有人想知道,显然 alt+enter 的依赖并不正确.

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:

  • 包括 ':libraries:tess-two'

进入 gradle.settings,将 tess-two 结构的整个项目移动到 'libraries/tess-two' 中(当 'libraries' 与您的 'app' 文件夹处于同一级别时).

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

之后(如果你在local.properties中设置了ndk.dir=C:path),你就可以设置模块依赖 进入你的主项目...

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...

右击app->Open Module Settings(或F4),然后点击右侧的加号,将tess-2作为模块添加到您的项目应用程序中.

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

请注意,'tess-two' 文件夹必须包含自己的 build.gradle(manifestfile 和 project.properties)文件,以便它可以自行构建.

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

这篇关于包括 *.so 库 Android Studio tess-two (tesseract)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆