apply plugin: 'com.android.library' android { compileSdkVersion 24 buildToolsVersion "24.0.2" task ndkBuild(type: Exec){ description "builds JNI libs from source. " + "This requires the Android NDK and is optional as precompiled libs are provided." workingDir = "./src/main" def ndkDir = android.ndkDirectory //Need to start cmd first on windows systems, otherwise these are the same if (System.properties["os.name"].toLowerCase().contains("windows")){ commandLine "cmd", "/c" , "$ndkDir${File.separator}ndk-build " + "NDK_APPLICATION_MK=./jniSources/Application.mk " + "NDK_LIBS_OUT=./jniLibs" } else { commandLine "$ndkDir${File.separator}ndk-build " + "NDK_APPLICATION_MK=./jniSources/Application.mk " + "NDK_LIBS_OUT=./jniLibs" } } }