I am trying to create NDK application dependent on OpenCV with new experimental gradle plugin in Android Studio but I can't really setup my build.gradle
correctly.
My NDK setup in build.gradle
looks like this:
/*
* native build settings
*/
android.ndk {
moduleName = "nonfree_jni"
stl = "gnustl_static"
cppFlags += "-I${opencv_path}".toString()
}
where opencv_path
is path to my OpenCV Android SDK (include directory)
If I open my .cpp
file, the OpenCV classes and files are properly colored and everything looks OK but when I try to build project a lot of "undefined reference: cv::something" occurs.
I did not find any tutorial to run OpenCV in Android Studio (only that with manual ndk-build command) and don't really know how to fix this. Some stackoverflow post said that this errors happens when I don't point to OpenCV.mk
in my Android.mk
configuration but I obviously don't have this option.
Any ideas?