Comments (5)
Hi @alexander-zou, maybe your problem is about the standard c++ library.
What i mean is that OpenCV use the gnustl_shared
standard library, so if you don't use this library in your android project, the compiler will complain with every methods that has string or vector as argument.
If you use CMake you can add this snippet in your build.gradle under android->defaultConfig
:
externalNativeBuild {
cmake {
cppFlags "-std=c++11 -fexceptions"
abiFilters 'x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'arm64-v8a' //keep only supported arch by your app
arguments "-DANDROID_PLATFORM=android-15", // change with your min api level
"-DANDROID_TOOLCHAIN=clang",
"-DANDROID_STL=gnustl_shared", // the standard lib
"-DANDROID_CPP_FEATURES=rtti exceptions"
}
}
and in your CMakeLists
you have to add something like this:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions -std=gnustl")
that is, i hope it works!
from learnopencv.
@Luca96 your previous comment worked for me finally. This was indeed an issue with gnu and libc++ stl. But I had to modify this
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions -std=gnustl")
to
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions -std=gnu++11")
from learnopencv.
I am desperate with the same problem in my android project, may I ask how did you solve it? Thank you so much!
from learnopencv.
Hi, from the official docs (https://developer.android.com/ndk/guides/cpp-support.html) the gnustl is deprecated from ndk16 and will be removed.
gnustl
The GNU C++ Library is called gnustl on Android to differentiate it from the system runtime. This runtime is the libstdc++ available on a GNU/Linux system.
This runtime is tightly coupled to GCC, which is no longer supported in the NDK. As such, it has not received updates for several releases. The version in the NDK only supports C++11, and some portions of this library are incompatible with Clang.
Note: This library will be deprecated and removed in a future NDK release. Beginning with NDK r16, you should use libc++ instead.
I'm having the same issue for couple of days now.
from learnopencv.
Maybe you can try to recompile OpenCV with libc++
instead of gnustl
.
from learnopencv.
Related Issues (20)
- Automatic-Document-Scanner - not working HOT 2
- Is the more code for article "What is Face Detection? Ultimate Guide 2023 + Model Comparison"? HOT 1
- VAE_Cartoon_Tensorflow Training HOT 4
- How to use OpenCV DNN Module on Windows with c++ HOT 3
- opencv_face_detector_uint8.pb missing HOT 5
- pkg-config: No such file or directory
- How to effectively judge image clarity by opencv ? HOT 1
- Reshape issue while running net.forward() HOT 3
- opencv4 doesn't have TrackerBoost::create() function not found as well as for TLD and MEDIANFLOW HOT 2
- ## DCGAN
- Face morphing
- How to Normalize Object Segmentation Dataset? HOT 1
- OpenCV
- Build was not completed correctly.
- When I give make -j12 its not build completely :OpenCv-CUDA-Module
- Cannot run "Human-Action-Recognition-Using-Detectron2-And-Lstm"
- The VideoStabilization demo contains an access violation
- Contour-Detection-using-OpenCV/cpp/contour_approximations/contour_approx.cpp 65行代码是不是写错了 HOT 2
- Potential performance issue in Face-Recognition-with-ArcFace: plotting slow in matplotlib == 3.3.0
- Error how can i resolve it HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from learnopencv.