进程“ NDK PATH”命令以非零退出值2完成

时间:2019-07-01 19:51:39

标签: android android-ndk android-gradle

我正在尝试将此library添加到我的应用中,但是当我运行该应用时,出现此错误:

  

处理'命令'D:\ Sdk \ ndk-bundle \ ndk-build.cmd'完成   非零退出值2

Build.Gradle:

apply plugin: 'com.android.library'
android {
    buildToolsVersion "28.0.3"
    compileSdkVersion 28
    sourceSets {
        main {
            java.srcDirs 'src'
            res {
                srcDirs 'res'
            }
            manifest.srcFile 'AndroidManifest.xml'
            jni.srcDirs = []
            jniLibs.srcDir 'libs'
        }
    }

    task ndkBuild(type:Exec) {
        workingDir file('./')
        commandLine getNdkBuildCmd()
    }

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

    task cleanJni(type:Exec) {
        workingDir file('./')
        commandLine getNdkBuildCmd(), 'clean'
    }

    clean.dependsOn cleanJni

}
def getNdkBuildCmd() {
    def ndkbuild = "D:\\Sdk\\ndk-bundle\\ndk-build.cmd"
    return ndkbuild
}

路径:

enter image description here

1 个答案:

答案 0 :(得分:0)

修改此功能以赋予驱动器名称“ D \”

def getNdkBuildCmd() {
    def ndkbuild = "D\:\\Sdk\\ndk-bundle\\ndk-build.cmd"
    return ndkbuild
}