sravanalakshmi.sunkara sravanalakshmi.sunkara - 1 year ago 124
Android Question

Build Error with Android+JNI+OpenCV

Iam New to Android OpenCV+NDK devlopment. I want to find out the largest contour in the image in Android for that I am trying to build the JNI Integrated OpenCV Android project in eclipse. I've included


to the project -> Properties -> C/C++ General -> Paths and Symbols -> Includes under GNU C++

If I tried to build the project I am still getting the build error.

showing error as 'class std::vector > >' has no member named 'toArray' at the line Point points = contours.toArray();

What is this error. How can I resolve this.

and my Console Output is:

* Incremental Build of configuration Default for project OpenCV-Square-Tracking-Android-JNI-master ****
/home/dharaniinfotech/Downloads/android-ndk-r10d/ndk-build all
Android NDK: WARNING:jni/ non-system libraries in linker flags: -lboost_system-gcc-mt-1_53 -lboost_regex-gcc-mt-1_53 -lboost_filesystem-gcc-mt-1_53 -lboost_date_time-gcc-mt-1_53

Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES

Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the

Android NDK: current module

[armeabi-v7a] Compile++ thumb: native_sample <= jni_part.cpp
jni/jni_part.cpp: In function 'jint Java_org_opencv_samples_tutorial3_Sample3Native_FindSquares(JNIEnv*, jobject, jlong, jint)':
jni/jni_part.cpp:77:30: error: 'class std::vector > >' has no member named 'toArray'
jni/jni_part.cpp:82:25: error: no match for 'operator[]' in 'points[i]'
make: *
[obj/local/armeabi-v7a/objs-debug/native_sample/jni_part.o] Error 1

Please Help me to know what I am missing.

Answer Source

First thing I've wrongly included


They should be like


And go to Code Analysis(right click the project-> C/C++ General) and select use project settings and uncheck all the check boxes.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download