Ask Your Question
0

the import org.opencv.android cannot be resolved

asked 2014-03-04 03:12:17 -0500

Mick gravatar image

updated 2014-03-04 03:29:43 -0500

berak gravatar image

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 flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
2

answered 2014-08-04 14:40:02 -0500

autodev101 gravatar image

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

edit flag offensive delete link more
0

answered 2014-09-05 10:17:45 -0500

crazymichel1 gravatar image

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

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-03-04 03:12:17 -0500

Seen: 9,401 times

Last updated: Sep 05 '14