我想运行我的项目以测试已创建的程序,而同步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
请帮帮我。谢谢
您的gradle任务swigPs
调用命令swig
。您的计算机很可能缺少此命令。要安装SWIG:
...在Ubuntu上:sudo apt install swig
...在MacOS上:brew install swig