我正在使用 vuforia API来制作增强现实应用程序。现在我正在尝试集成另一个库( opencv )。我在 android.mk 文件中进行了更改。但我仍然不能在同一个文件.cpp中使用opencv库和QCAR库 我试图访问java类来链接使用QCAR的文件和使用OPENCV的文件,但这个映射是一个时间消耗。 我需要在同一个文件中使用这两个库。这是我的android.mk文件:
我编辑了评论中提到的代码:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := QCAR-prebuilt
LOCAL_SRC_FILES = ../../../build/lib/$(TARGET_ARCH_ABI)/libQCAR.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../build/include
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_PRELINK_MODULE := false
OPENCV_LIB_TYPE:=STATIC
include $(LOCAL_PATH)/../../../OpenCV-2.4.5-android-sdk/sdk/native/jni/OpenCV.mk
LOCAL_MODULE := ImageTargets
USE_OPENGL_ES_1_1 := false
ifeq ($(USE_OPENGL_ES_1_1), true)
OPENGLES_LIB := -lGLESv1_CM
OPENGLES_DEF := -DUSE_OPENGL_ES_1_1
else
OPENGLES_LIB := -lGLESv2
OPENGLES_DEF := -DUSE_OPENGL_ES_2_0
endif
LOCAL_CFLAGS := -Wno-write-strings -Wno-psabi $(OPENGLES_DEF)
LOCAL_LDLIBS += \
-llog $(OPENGLES_LIB)
LOCAL_SHARED_LIBRARIES += QCAR-prebuilt
LOCAL_SRC_FILES := ImageTargets.cpp SampleUtils.cpp Texture.cpp SampleMath.cpp
LOCAL_ARM_MODE := arm
include $(BUILD_SHARED_LIBRARY)
mon fichier application.mk:
APP_ABI := armeabi armeabi-v7a
APP_PLATFORM := android-8
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions
当我构建项目而不在我的ImageTargets.cpp中添加任何opencv函数时,我得到了这个:
E:\android-ndk-r8\ndk-build.cmd all
"Compile++ arm : ImageTargets <= ImageTargets.cpp
"Compile++ arm : ImageTargets <= SampleUtils.cpp
"Compile++ arm : ImageTargets <= Texture.cpp
"Compile++ arm : ImageTargets <= SampleMath.cpp
Prebuilt : libopencv_contrib.a <= jni/../../../OpenCV-2.4.5-android- sdk/sdk/native/jni/../libs/armeabi/
Prebuilt : libopencv_legacy.a <= jni/../../../OpenCV-2.4.5-android-sdk/sdk/native/jni/../libs/armeabi/
Prebuilt : libopencv_ml.a <= jni/../../../OpenCV-2.4.5-android-sdk/sdk/native/jni/../libs/armeabi/
Prebuilt : libopencv_stitching.a <= jni/../../../OpenCV-2.4.5-android-sdk/sdk/native/jni/../libs/armeabi/
Prebuilt : libopencv_objdetect.a <= jni/../../../OpenCV-2.4.5-android-sdk/sdk/native/jni/../libs/armeabi/
Prebuilt : libopencv_ts.a <= jni/../../../OpenCV-2.4.5-android-sdk/sdk/native/jni/../libs/armeabi/
Prebuilt : libopencv_videostab.a <= jni/../../../OpenCV-2.4.5-android-sdk/sdk/native/jni/../libs/armeabi/
Prebuilt : libopencv_calib3d.a <= jni/../../../OpenCV-2.4.5-android-sdk/sdk/native/jni/../libs/armeabi/
Prebuilt : libopencv_photo.a <= jni/../../../OpenCV-2.4.5-android-sdk/sdk/native/jni/../libs/armeabi/
Prebuilt : libopencv_video.a <= jni/../../../OpenCV-2.4.5-android-sdk/sdk/native/jni/../libs/armeabi/
Prebuilt : libopencv_features2d.a <= jni/../../../OpenCV-2.4.5-android-sdk/sdk/native/jni/../libs/armeabi/
Prebuilt : libopencv_highgui.a <= jni/../../../OpenCV-2.4.5-android-sdk/sdk/native/jni/../libs/armeabi/
Prebuilt : libopencv_androidcamera.a <= jni/../../../OpenCV-2.4.5-android-sdk/sdk/native/jni/../libs/armeabi/
Prebuilt : libopencv_flann.a <= jni/../../../OpenCV-2.4.5-android-sdk/sdk/native/jni/../libs/armeabi/
Prebuilt : libopencv_imgproc.a <= jni/../../../OpenCV-2.4.5-android-sdk/sdk/native/jni/../libs/armeabi/
Prebuilt : libopencv_core.a <= jni/../../../OpenCV-2.4.5-android-sdk/sdk/native/jni/../libs/armeabi/
Prebuilt : liblibjpeg.a <= jni/../../../OpenCV-2.4.5-android-sdk/sdk/native/jni/../3rdparty/libs/armeabi/
Prebuilt : liblibpng.a <= jni/../../../OpenCV-2.4.5-android-sdk/sdk/native/jni/../3rdparty/libs/armeabi/
Prebuilt : liblibtiff.a <= jni/../../../OpenCV-2.4.5-android-sdk/sdk/native/jni/../3rdparty/libs/armeabi/
Prebuilt : liblibjasper.a <= jni/../../../OpenCV-2.4.5-android-sdk/sdk/native/jni/../3rdparty/libs/armeabi/
Prebuilt : libIlmImf.a <= jni/../../../OpenCV-2.4.5-android-sdk/sdk/native/jni/../3rdparty/libs/armeabi/
SharedLibrary : libImageTargets.so
Install : libImageTargets.so => libs/armeabi/libImageTargets.so
Install : libQCAR.so => libs/armeabi/libQCAR.so
"Compile++ arm : ImageTargets <= ImageTargets.cpp
"Compile++ arm : ImageTargets <= SampleUtils.cpp
"Compile++ arm : ImageTargets <= Texture.cpp
"Compile++ arm : ImageTargets <= SampleMath.cpp
SharedLibrary : libImageTargets.so
Install : libImageTargets.so => libs/armeabi-v7a/libImageTargets.so
Install : libQCAR.so => libs/armeabi-v7a/libQCAR.so
但是当我在ImageTargets.cpp中添加opencv
函数(已使用QCAR library
)时,我得到:E:/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld.exe: Warning: ./obj/local/armeabi/libopencv_core.a(array.cpp.o): Unknown EABI object attribute 44
我在这个文件中做错了什么想法?