任务':app:swigPs'执行失败。 >处理'命令'swig'完成,退出值非零1

问题描述 投票:1回答:1

我想运行我的项目以测试已创建的程序,而同步Gradle不是错误,但是当项目生成错误时:

Error:Execution failed for task ':app:swigPs'. > Process 'command 'swig'' finished with non-zero exit value 1

这是我在应用程序中的Gradle:

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

task ndkBuild(type: Exec) {
    commandLine "${ndkDir}/ndk-build${ndkExt}"
}
ndkBuild.outputs.dir "libs"
ndkBuild.outputs.dir "obj"

task mkdir < {
    new File('build/generated-src/java').mkdirs()
}

task swigSb(type: Exec) {
    commandLine 'swig',
            "-I../sphinxbase/include", "-I../sphinxbase/swig",
            "-java", "-package", "edu.cmu.pocketsphinx",
            "-outdir", "build/generated-src/java", "-o", "jni/sphinxbase_wrap.c",
            "../sphinxbase/swig/sphinxbase.i"
}

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

task swigPs(type: Exec) {
    commandLine 'swig',
            "-I../sphinxbase/swig",
            "-I../pocketsphinx/include",
            "-I../pocketsphinx/swig",
            "-java", "-package", "edu.cmu.pocketsphinx",
            "-outdir",  "build/generated-src/java",
            "-o", "jni/pocketsphinx_wrap.c",
            "../pocketsphinx/swig/pocketsphinx.i"
}

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

tasks.withType(JavaCompile) {
    compileTask -> compileTask.dependsOn mkdir
}
gradle.projectsEvaluated {
    preBuild.dependsOn mkdir
    preBuild.dependsOn swigSb
    preBuild.dependsOn swigPs
    preBuild.dependsOn ndkBuild
}

/*compileJava.dependsOn mkdir
compileJava.dependsOn swigSb
compileJava.dependsOn swigPs
compileJava.dependsOn ndkBuild*/

ndkBuild.dependsOn swigSb
ndkBuild.dependsOn swigPs

完整Gradle文件Because my code too much

Gradle Console出现错误Gradle Console

请帮帮我。谢谢

android android-studio android-gradle-plugin speech-recognition cmusphinx
1个回答
0
投票

您的gradle任务swigPs调用命令swig。您的计算机很可能缺少此命令。要安装SWIG

...在Ubuntu上:sudo apt install swig

...在MacOS上:brew install swig

© www.soinside.com 2019 - 2024. All rights reserved.