Linker errors in Android App using OpenCV: undefined reference to 'std::__ndk1::to_string(int)


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 and 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

APP_CPPFLAGS := -frtti -fexceptions -std=c++11
include …/opencv/build/install/sdk/native/jni/

And also set the include path in to something like this:


Thanks in advance for any help!