Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Execution failed for task ':app:compileDebugNdk'

I'm using the latest android studio build 1.1 ,since i want to import an eclipse project that needs NDK .i installed NDK and set the NDK location in the local.properties.The problem is when i try to run the project 2 errors are displayed they are

1) Error:(199) *** Android NDK: Aborting...    .  Stop.
2)Error:Execution failed for task ':app:compileDebugNdk'.
> com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException: Process 'command 'C:\Users\vishal\android-ndk-r10d\ndk-build.cmd'' finished with non-zero exit value 2

any solution?

like image 581
vishalaestro Avatar asked Feb 27 '15 07:02

vishalaestro


3 Answers

Try adding this to the build.gradle file:

sourceSets.main {
   jni.srcDirs = []
}
like image 160
c4sh Avatar answered Oct 21 '22 03:10

c4sh


This solved my problem:

  • If you don't have th JNI directory in your project, create it:

enter image description here

  • Go to the new JNI directory that you just created. It should be in{approot}\app\src\main\jni

enter image description here

  • Create an empty *.c file

enter image description here

  • Add the following code to your app/gradle.build file, in the android section. It should look like this:

    android {
        ...
        sourceSets.main {
            jniLibs.srcDir 'libs'
            jni.srcDirs = [] //disable automatic ndk-build call
        }
    }
    
like image 21
Jorge E. Hernández Avatar answered Oct 21 '22 03:10

Jorge E. Hernández


May be this is known NDK bug. Try to add empty .c file to your jni dir (like empty.c).

like image 3
senneco Avatar answered Oct 21 '22 03:10

senneco