Elyes Sellami
Elyes Sellami

Reputation: 11

Error:Execution failed for task ':app:ndkBuild'. > A prob lem occurred starting process 'command 'ndk-build.cmd''

I've tried everything to solve this but I still can't. This is the build.gradle: app part that may be causing the problem:

task ndkBuild(type: Exec,description: 'run ndk-build') {
    if (Os.isFamily(Os.FAMILY_WINDOWS)) {
        workingDir 'jni'
        commandLine 'ndk-build.cmd', '-j' , Runtime.runtime.availableProcessors()
    } else {
        workingDir 'jni'
        commandLine "ndk-build", '-j', Runtime.runtime.availableProcessors()
    }
}
tasks.withType(JavaCompile) {
    compileTask -> compileTask.dependsOn(ndkBuild)
}

I also changed this:

NDK_TOOLCHAIN_VERSION := 4.9 ( was 4.8)

And of course :

ndk.dir=C:\Users\Elyes\AppData\Local\Android\Sdk\ndk-bundle
sdk.dir=C:\Users\Elyes\AppData\Local\Android\Sdk

And it still doesn't work.

Upvotes: 1

Views: 654

Answers (1)

Stanislav Bondar
Stanislav Bondar

Reputation: 6265

Im using the following command on windows pc

task buildNative(type: Exec) {
  workingDir 'jni'// directory app/jni
  commandLine("${android.ndkDirectory}\\ndk-build.cmd", '-j', Runtime.runtime.availableProcessors())
}

Upvotes: 1

Related Questions