4

No matter how many tutorials I followed, every time I try to make a project containing C source files gradle outputs the error:

Error:Execution failed for task ':app:compileDebugNdk'.

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\svprdga\Downloads\android-ndk-r10d_x86\ndk-build.cmd'' finished with non-zero exit value 2

For example, I downloaded the following tutorial, which also throws the same error:

https://github.com/mpospelov/android-studio-ndk-hello-world

I have seen the following questions, but I not understand exactly what I am supposed to do:

execution failed for task ':app:compileDebugNdk' failed to run this command ndk-build.cmd Can't build project with android-ndk and Android Studio

Any help?

Community
  • 1
  • 1
svprdga
  • 2,171
  • 1
  • 28
  • 51

2 Answers2

1

Maybe this answer will help: https://stackoverflow.com/a/28810873 "Try to add empty .c file to your jni dir (like empty.c)". It worked in my case - Android Studio 1.1.0 with android-ndk-r10d-windows-x86_64

Community
  • 1
  • 1
Nike Khin
  • 21
  • 3
0

The version code of compileSdkVersion and buildToolsVersion should be consistent in the module build.gradle file. eg.

android { 
    compileSdkVersion 20 
    buildToolsVersion "20.0.0"
    ...
}
Phorus
  • 41
  • 3