Skip to content

Instantly share code, notes, and snippets.

@Sren-Hmkn
Created August 6, 2018 09:51
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 Sren-Hmkn/900030a4d7defa9a2b9d48c88c682fb4 to your computer and use it in GitHub Desktop.
Save Sren-Hmkn/900030a4d7defa9a2b9d48c88c682fb4 to your computer and use it in GitHub Desktop.
build.gradle (app) File for OpenCV setup
sourceSets.main.jni.srcDirs = []
task ndkBuild(type: Exec, description: 'Compile JNI source via NDK') {
def ndkDir = "{YOUR NDK_PATH, i.e. /home/USERNAME/Android/Sdk/ndk-bundle}"
commandLine "$ndkDir/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
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable = true
jniDebuggable true
}
}
@engFelipeMonteiro
Copy link

I had the following error

Could not get unknown property 'sourceSets' for project ':openCVLib410' of type org.gradle.api.Project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment