Skip to content

Instantly share code, notes, and snippets.

@navinpai
Created September 23, 2016 21:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save navinpai/c447eebd3105d59f7eb27bd04c8273c7 to your computer and use it in GitHub Desktop.
Save navinpai/c447eebd3105d59f7eb27bd04c8273c7 to your computer and use it in GitHub Desktop.
build.gradle with custom ndkBuild task
sourceSets.main {
jni.srcDirs = [] //disable automatic ndk-build call
jniLibs.srcDir 'src/main/jni'
}
task ndkBuild(type: Exec, description: 'Compile JNI source via NDK') {
commandLine "<path to your ndk>/ndk-build",
'NDK_PROJECT_PATH=build/intermediates/ndk',
'NDK_LIBS_OUT=src/main/jniLibs',
'APP_BUILD_SCRIPT=src/main/jni/Android.mk',
'NDK_APPLICATION_MK=src/main/jni/Application.mk'
}
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn ndkBuild
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment