我的应用程序有一个本机部分,可以调用本机Opencv的Camera库。
我唯一的问题是NDK-build不会自动将必要的libnative_camera * * .so复制到libs
文件夹中。
每次我对JNI的代码进行更改时(每分钟大约需要3次),我必须手动复制它们,这很好但很烦人。
只有native_camera库才会发生这种情况,opencv_java
会自动复制。
这是我的Android.mk:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
OPENCV_INSTALL_MODULES:=on
OPENCV_CAMERA_MODULES:=on
OPENCV_LIB_TYPE:=SHARED
OPENCV_PATH := /home/tran/signs/OpenCV-2.4.5-android-sdk/sdk/native
include $(OPENCV_PATH)/jni/OpenCV.mk
LOCAL_SRC_FILES := cameramodule.cpp
LOCAL_C_INCLUDES += $(LOCAL_PATH)
LOCAL_LDLIBS += -lGLESv1_CM -ldl -llog
LOCAL_MODULE := cameramodule
include $(BUILD_SHARED_LIBRARY)
如何更改它以告诉NDK-build为我复制和粘贴?
更新
我使用Eclipse编译我的应用程序。 这是项目的结构:
PROJECT
|
|
|---src
|---gen
|---res
|---jni
|---libs
|---lib (Someone suggest this folder but I can see it has no use)
|... files and temporary folders
**更新**
ndk-build
日志:
rm -f project/libs/armeabi/lib*.so project/libs/armeabi-v7a/lib*.so project/libs/mips/lib*.so project/libs/x86/lib*.so
rm -f project/libs/armeabi/gdbserver project/libs/armeabi-v7a/gdbserver project/libs/mips/gdbserver project/libs/x86/gdbserver
rm -f project/libs/armeabi/gdb.setup project/libs/armeabi-v7a/gdb.setup project/libs/mips/gdb.setup project/libs/x86/gdb.setup
Install : libcameramoduleged.so => libs/armeabi-v7a/libcameramodule.so
install -p project/obj/local/armeabi-v7a/libcameramodule.so project/libs/armeabi-v7a/libcameramodule.so
ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-strip --strip-unneeded project/libs/armeabi-v7a/libcameramodule.so
Install : libopencv_java.so => libs/armeabi-v7a/libopencv_java.so
install -p project/obj/local/armeabi-v7a/libopencv_java.so project/libs/armeabi-v7a/libopencv_java.so
ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin/arm-linux-androideabi-strip --strip-unneeded project/libs/armeabi-v7a/libopencv_java.so
答案 0 :(得分:0)
将构建共享库移至Android.mk的顶部:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := cameramodule.cpp
LOCAL_C_INCLUDES += $(LOCAL_PATH)
LOCAL_LDLIBS += -lGLESv1_CM -ldl -llog
LOCAL_MODULE := cameramodule
include $(BUILD_SHARED_LIBRARY)
OPENCV_INSTALL_MODULES:=on
OPENCV_CAMERA_MODULES:=on
OPENCV_LIB_TYPE:=SHARED
OPENCV_PATH := /home/tran/signs/OpenCV-2.4.5-android-sdk/sdk/native
include $(OPENCV_PATH)/jni/OpenCV.mk
答案 1 :(得分:0)
尝试使用NDK_APP_OUT并将其指向您希望该库驻留的任何目录。