Can't build OpenCV library and samples for Android: OpenCVEngineInterface and org.opencv.R
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:
The import org.opencv.R cannot be resolved
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)`
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.