如何使用非零退出值2完成修复

时间:2017-11-26 12:22:58

标签: java android build.gradle ocr tesseract

import org.apache.tools.ant.taskdefs.condition.Os

apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'

Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties')
.newDataInputStream())

android {
compileSdkVersion 23
buildToolsVersion '26.0.2'

defaultConfig {
    minSdkVersion 9
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
    consumerProguardFiles 'proguard-rules.pro'
}

sourceSets {
    main {
        manifest.srcFile 'AndroidManifest.xml'
        java.srcDirs = ['src']
        res.srcDirs = ['res']
        resources.srcDirs = ['src']
        res.srcDirs = ['src/main/res']
        jni.srcDirs = []
       // jniLibs.srcDirs = ['libs']
        jniLibs.srcDir 'src/main/libs'


    }
}



// call regular ndk-build(.cmd) script from app directory
task ndkBuild(type: Exec) {
    if (Os.isFamily(Os.FAMILY_WINDOWS)) {
        commandLine 'C:/User/frando/AddData/Local/Android/sdk/android-ndk-r16/ndk-build.cmd', '-C', file('src/main').absolutePath
    } else {
        commandLine 'C:/User/frando/AddData/Local/Android/sdk/android-ndk-r16/ndk-build.cmd', '-C', file('src/main').absolutePath
    }
}

tasks.withType(JavaCompile) {
    compileTask -> compileTask.dependsOn ndkBuild
}

// Cleanup task to remove previously generated binaries
task ndkClean(type: Exec) {
    def ndkDirProperty = properties.getProperty('ndk.dir')
    def ndkDirPrefix = ndkDirProperty != null ? ndkDirProperty + '/' : ''

    def ndkBuildExt = Os.isFamily(Os.FAMILY_WINDOWS) ? ".cmd" : ""

  //  commandLine "${ndkDirPrefix}ndk-build${ndkBuildExt}", '-C', file('.').absolutePath, 'clean'
    commandLine 'C:/User/frando/AddData/Local/Android/sdk/android-ndk-r16/ndk-build.cmd', '-C', file('.').absolutePath, 'clean'
}

tasks.withType(Delete) {
    cleanTask -> cleanTask.dependsOn ndkClean
}

}

这被多次询问,我尝试了我看到的每一种解决方案,但对我来说没有任何作用。我收到了这个错误并且已经工作了2天来解决这个问题,请帮助解决这个问题。

  

错误:任务':libraries:tess-two:ndkBuild'的执行失败。   进程'命令'C:/User/frando/AddData/Local/Android/sdk/android-ndk-r16/ndk-build.cmd''以非零退出值2完成

1 个答案:

答案 0 :(得分:0)

我按照本教程

解决了这个问题

ocr step by step