# the import org.opencv.android cannot be resolved

I am attempting to get opencv for android/eclipse working for the first time. I am following this documentation. I have imported the library and samples into a new eclipse workspace. The OpenCVLibrary project appears to be built without error.

Now I'm trying to get OpenCV Sample - face-detection up and running, but am getting errors like

the import org.opencv.android cannot be resolved


and

the import org.opencv.core cannot be resolved


at the start of the java files.

I had noticed that in the properties of the library project, the "is library" check-box had not been ticked, so I ticked it and did a clean and rebuild. But this made no difference. Any idea what I've done wrong?

Edit: I looked round the files within the library project trying to determine what the actual library file was. My guess was that it would appear within the bin directory (just like where apk files appear). In that directory I saw a file called "opencv library - @opencv_version@.jar", which I thought could be it. But when I looked at its properties I saw it was only 166 bytes long- presumably much too small. I could not figure out any other file within the project's directory tree which looked like it could be the actual opencv library.

edit retag close merge delete

Sort by » oldest newest most voted

and in addition to autodev101s solution (which worked for me) make sure that you do not copy the samples into your workspace but just reference them, otherwise you get a couple of further errors

more

Hi,

i don't know if you fix this but in case you didn't since no body bother to answer: You need to right click the project go to Properties, then java Build Path and click Add External JAR. Then locate opencv library-2.4.x.jar and click Open. You can find it in X:\OpenCV-2.4.8-android-sdk\sdk\java\bin

Regards

more

Official site

GitHub

Wiki

Documentation