Ask Your Question
0

Can't build OpenCV library and samples for Android: OpenCVEngineInterface and org.opencv.R

asked 2013-12-15 16:38:31 -0500

IZ73 gravatar image

updated 2013-12-16 06:26:25 -0500

I have a bit of experience with Android development using Java. Now I want to try porting some C/C++ code that uses OpenCV to Android. First, I tried to build the OpenCV lib and samples for Android using Eclipse on a Win-7 64-bit machine.

I've installed Java 7 JDK, Cygwin, Eclipse, NDK and CDK (or at least I think I have). When I try building the project, I get these 2 errors:

  1. The import org.opencv.R cannot be resolved
  2. The import org.opencv.engine.OpenCVEngineInterface cannot be resolved

I noticed that there is a OpenCVEngineInterface.aidl file that is supposed to get converted to .java but I don't think it's happening

Also, when I try to do Android Tools -> Fix Project Properties, nothing happens: no window is opened etc. Maybe my dev environment is not set up correctly?

What should I do to get these resolved and to build the project?

Also, I do not currently have an actual Android device to test the code on. Can I run the samples in the emulator?

Thank you!

UPDATE: When I select Project -> Clean -> Clean all projects a window pops up with the message Cleaning all projects has encountered an error and Errors occurred during the build. Errors running builder 'Android Package Builder' on project 'OpenCV Library - 2.4.7.1'. Resource '/OpenCV Library - 2.4.7.1/bin' does not exist. Resource '/OpenCV Library - 2.4.7.1/bin' does not exist.

I created bin in my workspace\OpenCV Library - 2.4.7.1 but that did not help. After I proceed with the rebuild, I get this message in COnsole:

`07:20:13 * Auto Build of configuration Default for project OpenCV Tutorial 2 - Mixed Processing * "\ndk-build.cmd" Android NDK: WARNING:jni/Android.mk:mixed_sample: non-system libraries in linker flags: -lopencv_java
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] Install : libmixed_sample.so => libs/armeabi-v7a/libmixed_sample.so

07:20:13 Build Finished (took 228ms)`

edit retag flag offensive close merge delete

Comments

This warning is ok. It is produced by OpenCV.mk file. We are working on its improvement, so, it'll be fixed in future releases.

Alexander Smorkalov gravatar imageAlexander Smorkalov ( 2013-12-16 23:47:37 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
2

answered 2013-12-16 04:57:05 -0500

org.opencv.R and org.opencv.engine.OpenCVEngineInterface are auto generated classes. Eclipse or ant must generate it for you at build time. They are located in OpenCV library project. You need to build the library project first. Check for library project build errors. Possible you need to install Android SDK libraries for the target API level.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

Stats

Asked: 2013-12-15 16:38:31 -0500

Seen: 7,827 times

Last updated: Dec 16 '13