Ask Your Question

Revision history [back]

Android Studio 3.5 + OpenCV 4.1

I see OpenCV Manager is no longer on play store, and I found a post that mentioned you have to statically link the OpenCV library. I have tried a dozen different tutorials and I still can't get this to work.

I selected native C++ application and added this to CMakeList.txt

include_directories(/home/grom/OpenCV-android-sdk/sdk/native/jni/include)
add_library( lib_opencv SHARED IMPORTED )
set_target_properties(lib_opencv PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/src/main/jniLibs/${ANDROID_ABI}/libopencv_java3.so)

The article also says to add

cppFlags "-frtti -fexceptions"
abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'

But this gives me errors. Is there any guides that are up to date ?