Ask Your Question

ndk-build deletes native OpenCV library

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

ricktarder gravatar image

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

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 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 is gone What am I missing?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

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

Andrey Pavlenko gravatar image

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

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

include $(CLEAR_VARS)
include ../../sdk/native/jni/
edit flag offensive delete link more
Login/Signup to Answer

Question Tools


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

Seen: 1,306 times

Last updated: Oct 02 '12