I am making a C++ project which uses openCV and I wish to build it on android studio using android NDK support.
On doing so I found out that only the experimental version of gradle supports NDK. I am currently using version 0.2.1 of gradle. I imported opencv as a module and copied the libraries to jniLibs folder under src/main/
I tried to compile it but I got certain errors like undefined reference to some functions in parallel.cpp of libopencv_core.a . They were resolved on importing the third party library : libtbb.a
But on running it I got the following errors:
java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__gnu_thumb1_case_si" referenced by "libtracking_bits.so"
here is my build.gradle :
apply plugin: 'com.android.model.application'
model {
android {
compileSdkVersion = 21
buildToolsVersion = "22.0.1"
defaultConfig.with {
applicationId = "com.example.vlc.receiver"
minSdkVersion.apiLevel = 16
targetSdkVersion.apiLevel = 21
versionCode = 1
versionName = "1.0"
}
}
android.buildTypes {
release {
minifyEnabled = false
proguardFiles += file('proguard-rules.pro')
}
debug {
minifyEnabled = false
}
}
android.ndk {
moduleName = "tracking_bits"
cppFlags += "-fexceptions"
cppFlags += "-frtti"
cppFlags += "-I${file("OpenCV-android-sdk/sdk/native/jni/include")}".toString()
cppFlags += "-I${file("OpenCV-android-sdk/sdk/native/jni/include/opencv")}".toString()
ldLibs += ["android", "EGL", "GLESv2", "dl", "log", "z"]// , "ibopencv_core"
stl = "gnustl_shared"
}
android.productFlavors {
create("arm") {
ndk.with {
abiFilters += "armeabi"
File curDir = file('./')
curDir = file(curDir.absolutePath)
String libsDir = curDir.absolutePath+"\\src\\main\\jniLibs\\armeabi\\" //"-L" +
ldLibs += libsDir + "libopencv_calib3d.a"
ldLibs += libsDir + "libopencv_core.a"
ldLibs += libsDir + "libopencv_features2d.a"
ldLibs += libsDir + "libopencv_flann.a"
ldLibs += libsDir + "libopencv_hal.a"
ldLibs += libsDir + "libopencv_highgui.a"
ldLibs += libsDir + "libopencv_imgcodecs.a"
ldLibs += libsDir + "libopencv_imgproc.a"
ldLibs += libsDir + "libopencv_java3.so"
ldLibs += libsDir + "libopencv_ml.a"
ldLibs += libsDir + "libopencv_objdetect.a"
ldLibs += libsDir + "libopencv_photo.a"
ldLibs += libsDir + "libopencv_shape.a"
ldLibs += libsDir + "libopencv_stitching.a"
ldLibs += libsDir + "libopencv_superres.a"
ldLibs += libsDir + "libopencv_ts.a"
ldLibs += libsDir + "libopencv_video.a"
ldLibs += libsDir + "libopencv_videoio.a"
ldLibs += libsDir + "libopencv_videostab.a"
ldLibs += "OpenCV-android-sdk\\sdk\\native\\3rdparty\\libs\\armeabi\\libtbb.a"
}
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
compile project(':openCVLibrary300')
}
I am stuck. Please help.
I added all the 3rd party libraries too and this allowed to compile for arm. To be fair, I also added the 3rd party libraries in jniLibs, just to avoid changing the path as you did up there. Otherwise, I have exactly the same configuration as you, to the point that I copied and pasted your file in a previous stage.