我很新來openCV和android編程,我想在我的項目中使用openCV。現在我想在我的Android工作室運行的OpenCV的第2個教程,但我總是得到以下NDK錯誤:OpenCV與NDK支持在Android Studio工作
Error:Execution failed for task ':openCVTutorial2MixedProcessing:compileDebugNdk'.
NDK not configured. Download the NDK from http://developer.android.com/tools/sdk/ndk/.Then add ndk.dir=path/to/ndk in local.properties. (On Windows, make sure you escape backslashes, e.g. C:\ndk rather than C:\ndk)
然後我看了看網上有的人建議我應該把它們添加到我的gradle.build文件:
jniLibs.srcDirs = ['native-libs']
jni.srcDirs = [] //disable automatic ndk-build
添加這些它的工作原理後,但我得到了以下錯誤:
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/org.opencv.samples.tutorial2-2/base.apk"],nativeLibraryDirectories=[/data/app/org.opencv.samples.tutorial2-2/lib/arm64, /vendor/lib64, /system/lib64]]] couldn't find "libopencv_java3.so"
這是我的gradle這個文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "org.opencv.samples.tutorial2"
minSdkVersion 21
targetSdkVersion 23
ndk {
moduleName "mixed_sample"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
sourceSets{main {jni.srcDirs = ['src/main/jni','src/main/jniLibs']
jniLibs.srcDirs = ['native-libs']
jni.srcDirs = [] //disable automatic ndk-build
}}
}
dependencies {
compile project(':openCVLibrary310')
}