Hi,
I need to build OpenCV and integrate it into my Capacitor Android Plugin. Building OpenCV and including OpenCV in my c++ code worked. But when I ran the app, there are a lot of errors of this kind:
logtagconfigparser.cpp:301: error: undefined reference to ‘std::__ndk1::to_string(int)’
When I google this error, the proposed solution is to set APP_STL:=c++_static. So, I put this in my Android.mk and Apllication.mk but nothing changed.
Can you help me on this? I’m really stuck here.
Some more infos:
I compiled OpenCV using this parameters:
cmake “…” -DCMAKE_TOOLCHAIN_FILE=“/home/administrator/Android/Sdk/ndk/22.0.7026061/build/cmake/android.toolchain.cmake” -DANDROID_NDK=“/home/administrator/Android/Sdk/ndk/22.0.7026061” -DANDROID_SDK_ROOT=“/home/administrator/Android/Sdk” -DANDROID_NATIVE_API_LEVEL=28 -DBUILD_ANDROID_PROJECTS=OFF -DBUILD_ANDROID_EXAMPLES=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF -DBUILD_SHARED_LIBS=OFF -DBUILD_opencv_world=OFF -DANDROID_STL=c++_static
To use OpenCV in the Capacitor-Android-Plugin, I set this in the Android.mk
OPENCV_INSTALL_MODULES:=on
OPENCV_LIB_TYPE:=STATIC
APP_STL:=c++_static
APP_CPPFLAGS := -frtti -fexceptions -std=c++11
ANDROID_STL:=c++_static
include …/opencv/build/install/sdk/native/jni/OpenCV.mk
And also set the include path in Android.mk to something like this:
…/opencv/build/install/sdk/native/jni/include/
Thanks in advance for any help!