Ask Your Question
2

ndk-build deletes native OpenCV library

asked 2012-07-10 07:58:41 -0600

ricktarder gravatar image

updated 2012-10-02 06:05:12 -0600

V.G. gravatar image

I tried to create a own OpenCV-2.4.2 android project using Eclipse and OpenCV on Linux. I followed the steps from the tutorials (Tutorial on using native code and static libraries and Tutorial on creating an own OpenCV application) to use static library initialization instead the dynamic approach. Also I am using a small native C++ part wich calls OpenCVs FeatureDetector() method (similar to samples/tutorial-4-mixed).

So when I try to copy the native lib libopencv_java.so into /libs/armeabi-v7a (according to step 3), build and run the application on my device it will throw an ExceptionInitializerError: couldn't load library 'opencv_java'.

The app can't load the file because ndk-build deletes it on creation of the app. My own native code part is built and placed correctly in /libs/armeabi-v7a but opencv_java.so is gone What am I missing?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2012-07-11 03:10:18 -0600

Andrey Pavlenko gravatar image

Yes, this approach works on Windows but not on Linux...

I suggest the following alternative option:
Open the Android.mk of the project that uses initDebug() and add two lines between "include $(CLEAR_VARS)" and "include ../../sdk/native/jni/OpenCV.mk":

include $(CLEAR_VARS)
OPENCV_CAMERA_MODULES:=on
OPENCV_INSTALL_MODULES:=on
include ../../sdk/native/jni/OpenCV.mk
edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-07-10 07:58:41 -0600

Seen: 1,626 times

Last updated: Oct 02 '12