I am integrating opencv library with my project. I've successfully configured NDK using experimental gradle plugin. But getting error with Opencv. Here is the error showing in my cpp file.
My build.gradle is:
apply plugin: 'com.android.model.application'
model {
android {
compileSdkVersion = 23
buildToolsVersion = "23.0.0"
defaultConfig.with {
applicationId = "com.legalplex.dharani.android"
minSdkVersion.apiLevel = 14
targetSdkVersion.apiLevel = 23
buildConfigFields.with {
create() {
type = "int"
name = "VALUE"
value = "1"
}
}
}
}
android.ndk {
moduleName = "document_scanner"
cppFlags += "-fno-rtti"
cppFlags += "-fno-exceptions"
ldLibs = ["android", "log"]
stl ="gnustl_shared"
}
android.buildTypes {
release {
minifyEnabled = false
proguardFiles += file('proguard-rules.pro')
}
}
android.productFlavors {
// for detailed abiFilter descriptions, refer to "Supported ABIs" @
// https://developer.android.com/ndk/guides/abis.html#sa
create("arm") {
ndk.abiFilters += "armeabi"
}
create("arm7") {
ndk.abiFilters += "armeabi-v7a"
}
create("arm8") {
ndk.abiFilters += "arm64-v8a"
}
create("x86") {
ndk.abiFilters += "x86"
}
create("x86-64") {
ndk.abiFilters += "x86_64"
}
create("mips") {
ndk.abiFilters += "mips"
}
create("mips-64") {
ndk.abiFilters += "mips64"
}
// To include all cpu architectures, leaves abiFilters empty
create("all")
}
}
dependencies {
compile 'com.android.support:support-v4:19.1.0'
compile project(':openCVLibrary')
}
Why it is showing error at opencv includes even after adding module dependency in my gradle file. Please help me out. How to configure my build.gradle file to activate our own Android.mk. Here is my Android.mk file:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
include OpenCV-2.4.10-android-sdk\sdk\native\jni\OpenCV.mk
OPENCV_INSTALL_MODULES := on
LOCAL_MODULE := document_scanner
LOCAL_SRC_FILES := jni_part.cpp
LOCAL_C_INCLUDES := OpenCV-2.4.10-android-sdk\sdk\native\jni\include
OPENCV_LIB_TYPE:=STATIC
LOCAL_LDLIBS += -llog
include $(BUILD_SHARED_LIBRARY)