Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Problems using libnative_camera on Android

Hi all, after a lot of searching and tries I didn't manage to solve my problem. I'm trying to use the native camera module (through cv::VideoCapture initiated in a C++ source file) in an Android 4.1 project using JNI. I'm using Eclipse and everything compile, both "libnative_camera_r4.1.1.so" and "libNativeCamera.so" module are included in the compiled APK inside the lib/armeabi-v7a/ folder. However, I get this message error in the logcat when I try to run it:

03-18 16:33:07.367: W/dalvikvm(18039): No implementation found for native Lorg/opencv/highgui/VideoCapture;.n_VideoCapture:(I)J
03-18 16:33:07.372: W/dalvikvm(18039): threadid=1: thread exiting with uncaught exception (group=0x40e262d0)
03-18 16:33:07.372: E/AndroidRuntime(18039): java.lang.UnsatisfiedLinkError: Native method not found: org.opencv.highgui.VideoCapture.n_VideoCapture:(I)J

I'm quite sure that all the JNI methods defined by me link properly.
Why this error happens before the load of the OpenCV libraries by the OpenCVManager?
This is my android.mk file:

LOCAL_PATH  := $(call my-dir)
SDK_DIR     := /home/alvise/android/OpenCV-2.4.4-android-sdk
SDK_JNI_DIR := $(SDK_DIR)/sdk/native/jni

include $(CLEAR_VARS)


#OPENCV_CAMERA_MODULES:=on
#OPENCV_INSTALL_MODULES:=on
#OPENCV_LIB_TYPE:=STATIC
include $(SDK_JNI_DIR)/OpenCV.mk

### CAMERA MODULE
include $(CLEAR_VARS)
LOCAL_MODULE := camera-prebuilt
LOCAL_SRC_FILES = build/libs/$(TARGET_ARCH_ABI)/libnative_camera_r4.1.1.so
include $(PREBUILT_SHARED_LIBRARY)
### END CAMERA MODULE

OPENGLES_LIB  := -lGLESv1_CM
OPENGLES_DEF  := -DUSE_OPENGL_ES_1_1

LOCAL_MODULE    := NativeCamera
LOCAL_SRC_FILES := CameraRenderer.cpp
LOCAL_C_INCLUDES += $(LOCAL_PATH)
LOCAL_LDLIBS += $(OPENGLES_LIB) -llog -ldl
include $(BUILD_SHARED_LIBRARY)

The java and C++ part is quite common and I don't think that could help... Thank you in advance for any help!

alvise