I followed this tutorial https://www.youtube.com/watch?v=JIHfqzTdOcQ and in the final stage i can't compile the project. There is something wrong with my ndk, but i have no idea what to do. I tried everything, for example:
After many changes, I'm a little confused right now.
Here is the code of my build.gradle
import org.apache.tools.ant.taskdefs.condition.Os
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.aidan.opencvdemo"
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
sourceSets.main {
jniLibs.srcDir 'src/main/libs'
jni.srcDirs = [] //disable automatic ndk-build call
}
// call regular ndk-build(.cmd) script from app directory
task ndkBuild(type: Exec) {
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine 'ndk-build.cmd', '-C', file('src/main').absolutePath
} else {
commandLine 'ndk-build', '-C', file('src/main').absolutePath
}
}
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn ndkBuild
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.1'
compile project(':openCVLibrary310')
}
Here is messages gradle build
Information:Gradle tasks [:app:assembleDebug]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:openCVLibrary310:compileLint
:openCVLibrary310:copyReleaseLint UP-TO-DATE
:openCVLibrary310:mergeReleaseProguardFiles UP-TO-DATE
:openCVLibrary310:preBuild UP-TO-DATE
:openCVLibrary310:preReleaseBuild UP-TO-DATE
:openCVLibrary310:checkReleaseManifest
:openCVLibrary310:prepareReleaseDependencies
:openCVLibrary310:compileReleaseAidl UP-TO-DATE
:openCVLibrary310:compileReleaseRenderscript UP-TO-DATE
:openCVLibrary310:generateReleaseBuildConfig UP-TO-DATE
:openCVLibrary310:generateReleaseAssets UP-TO-DATE
:openCVLibrary310:mergeReleaseAssets UP-TO-DATE
:openCVLibrary310:generateReleaseResValues UP-TO-DATE
:openCVLibrary310:generateReleaseResources UP-TO-DATE
:openCVLibrary310:packageReleaseResources UP-TO-DATE
:openCVLibrary310:processReleaseManifest UP-TO-DATE
:openCVLibrary310:processReleaseResources UP-TO-DATE
:openCVLibrary310:generateReleaseSources UP-TO-DATE
:openCVLibrary310:compileReleaseJava UP-TO-DATE
:openCVLibrary310:processReleaseJavaRes UP-TO-DATE
:openCVLibrary310:packageReleaseJar UP-TO-DATE
:openCVLibrary310:compileReleaseNdk UP-TO-DATE
:openCVLibrary310:packageReleaseJniLibs UP-TO-DATE
:openCVLibrary310:packageReleaseLocalJar UP-TO-DATE
:openCVLibrary310:packageReleaseRenderscript UP-TO-DATE
:openCVLibrary310:bundleRelease UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72221Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42221Library UP-TO-DATE
:app:prepareOpenCVdemoOpenCVLibrary310UnspecifiedLibrary UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:ndkBuild FAILED
Error:Execution failed for task ':app:ndkBuild'.
> A problem occurred starting process 'command 'ndk-build.cmd''
Information:BUILD FAILED
Information:Total time: 1.673 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
Here is my project structure