Android Studio failed build NDK project non-zero exit value

For simple, you can try to insert sourceSets.main.jni.srcDirs = [] to android block in build.gradle file. This will tell gradle to look for your C++ files in different path.


This is known problem of Android Studio, caused by very limited support of NDK-enabled projects. Answering to your question: yes, Android Studio now run ndk-build on its own, but it ignore existing Android.mk and generate one on the fly (and do it wrong for any non-trivial NDK-enabled project). Practically, the best way to fix this is to disable Android Studio's limited NDK support and call ndk-build from gradle script. Here I've described it more detailed and how to get it fixed.