apply plugin: 'com.android.application' android { compileSdkVersion 22 ext { //git = org.ajoberstar.grgit.Grgit.open() gitVersionCode = 4 gitVersionName = "2019.1.0-6-g55005c1" } defaultConfig { applicationId "fr.enseeiht.defacer" minSdkVersion 8 //noinspection ExpiredTargetSdkVersion targetSdkVersion 8 versionCode gitVersionCode versionName gitVersionName ndk { moduleName "detection_based_tracker" } } sourceSets.main { jni.srcDirs = [] // This prevents the auto generation of Android.mk jniLibs.srcDir 'src/main/libs' // This is not necessary unless you have precompiled libraries in your project. } task buildNative(type: Exec, description: 'Compile JNI source via NDK') { def ndkDir = android.ndkDirectory commandLine "$ndkDir/ndk-build", '-C', file('src/main/jni').absolutePath, // Change src/main/jni the relative path to your jni source '-j', Runtime.runtime.availableProcessors(), 'all', 'NDK_DEBUG=1' } task cleanNative(type: Exec, description: 'Clean JNI object files') { def ndkDir = android.ndkDirectory commandLine "$ndkDir/ndk-build", '-C', file('src/main/jni').absolutePath, // Change src/main/jni the relative path to your jni source 'clean' } clean.dependsOn 'cleanNative' tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn buildNative } buildTypes { debug { versionNameSuffix ".debug" resValue "string", "app_version", "${defaultConfig.versionName}${versionNameSuffix}" } release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' resValue "string", "app_version", "${defaultConfig.versionName}" } } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) testImplementation 'junit:junit:4.12' implementation project(':openCVLibrary2410') }