在Android的Studio项目缺少allheaders.h项目、Android、Studio、allheaders

2023-09-06 15:55:18 作者:梦里梦离梦你

我下面从本的tesseract教程并且有,直到我的实际的Java的code运行一切顺利。当我尝试

I am following the tutorial from this tesseract tutorial and had everything go smoothly up until my actual running of the Java code. When I try

new TessBaseApi();

这引发以下错误

It throws the following error

Error Code: 2
Output:
In file included from tesstwo/src/main/jni/com_googlecode_leptonica_android/box.cpp:17:0:
tesstwo/src/main/jni/com_googlecode_leptonica_android/common.h:22:24: fatal error: allheaders.h: No such file or directory
 #include <allheaders.h>
           ^
compilation terminated.
make: *** 

我看着 / JNI / com_google code_leptonica_android / src目录/ src目录,找到 allheaders.h 文件存在。我有一种感觉,我的路径是错误的,但我已经试过几乎所有的东西,并没有用。有什么问题?

I have looked into /jni/com_googlecode_leptonica_android/src/src and find the allheaders.h file there. I have a feeling my paths are wrong, but I've tried almost everything and no avail. What's the issue?

推荐答案

我也遇到了这个问题,Android的工作室。谷歌上搜索一些之后,我发现这个问题。 的https://$c$c.google.com/p /安卓/问题/详细信息?ID = 74132

I also ran into this problem with Android Studio. After googling some more i found this issue. https://code.google.com/p/android/issues/detail?id=74132

显然,NDK插件生成它自己的Andr​​oid.mk文件,并忽略任何现有的,所以推荐的方法是运行NDK建造生成原生.so文件。

Apparently the NDK plugin generates it's own Android.mk file and ignore any existing one, so the recommended way is to run ndk-build to generate the native .so files.

当我在苔丝个目录它编译就好了,并创建.so文件使用NDK建造。

When I used ndk-build in the tess-two directory it compiles just fine and the .so files is created.

您可以包括如何在摇篮和Android工作室本机库在这个职位描述:Add pre建。所以采用Android摇篮插件的项目文件0.7.3

How you can include native libraries in gradle and android studio is described in this post: Add pre-built .so files in project using Android Gradle plugin 0.7.3