我正在尝试使用android studio从tess two项目构建eyes two。我做了
无条件建造
安卓。。。
蚂蚁释放
tess two和eyes two、imported eyes two、configured ndk.dir path和all的资料,但是,在构建时,我得到以下错误消息:

allheaders.h: No such file or directory

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':tesstwo:compileReleaseNdk'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/home/italomaia/.apps/android-ndk-r10c/ndk-build NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/home/italomaia/workspace/eyes-two/tesstwo/build/intermediates/ndk/release/Android.mk APP_PLATFORM=android-8 NDK_OUT=/home/italomaia/workspace/eyes-two/tesstwo/build/intermediates/ndk/release/obj NDK_LIBS_OUT=/home/italomaia/workspace/eyes-two/tesstwo/build/intermediates/ndk/release/lib APP_ABI=all
  Error Code:
    2
  Output:
    In file included from /home/italomaia/workspace/eyes-two/tesstwo/src/main/jni/com_googlecode_leptonica_android/writefile.cpp:17:0:
/home/italomaia/workspace/eyes-two/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: *** [$HOME/workspace/eyes-two/tesstwo/build/intermediates/ndk/release/obj/local/arm64-v8a/objs/tesstwo/$HOME/workspace/eyes-two/tesstwo/src/main/jni/com_googlecode_leptonica_android/writefile.o] Error 1


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

最佳答案

你应该按照这里的说明来构建它。https://github.com/rmtheis/tess-two/tree/master
我不得不稍微修改一下说明书。
要生成最新的tess两个代码,请在终端中运行以下命令:
git clone git://github.com/rmtheis/tess-two tesscd tesscd tess-twondk-buildandroid update project --path . --target 13
要构建眼睛2,请另外运行以下命令:
cd ..cd eyes-twondk-buildandroid update project --path . --target 13
从那里我打开了android studio,file->import sample并导入了hello jni示例。在android studio中设置并编译之后,我做了file->new->import模块,将它指向tess two目录,选择了所有默认值。在那一点上,它给了我错误,因为梯度问题。所以我为TESS两个模块制作了这个梯度文件:

apply plugin: 'com.android.model.library'

model {
    android {
        compileSdkVersion = 23
        buildToolsVersion = "23.0.0"

        defaultConfig.with {
            minSdkVersion.apiLevel = 15
            targetSdkVersion.apiLevel = 23
        }
    }


    compileOptions.with {
        sourceCompatibility=JavaVersion.VERSION_1_7
        targetCompatibility=JavaVersion.VERSION_1_7
    }

    android.buildTypes {
        release {
            minifyEnabled = false
            proguardFiles  += file('proguard-rules.txt')
        }
    }
    android.productFlavors {
        // for detailed abiFilter descriptions, refer to "Supported ABIs" @
        // https://developer.android.com/ndk/guides/abis.html#sa
        create("arm") {
            ndk.abiFilters += "armeabi"
        }
        create("arm7") {
            ndk.abiFilters += "armeabi-v7a"
        }
        create("arm8") {
            ndk.abiFilters += "arm64-v8a"
        }
        create("x86") {
            ndk.abiFilters += "x86"
        }
        create("x86-64") {
            ndk.abiFilters += "x86_64"
        }
        create("mips") {
            ndk.abiFilters += "mips"
        }
        create("mips-64") {
            ndk.abiFilters += "mips64"
        }
        // To include all cpu architectures, leaves abiFilters empty
        create("all")
    }

}

然后它成功地建造了

09-10 06:15