vuforia API を使用して拡張現実アプリケーションを作成しています。現在、別のライブラリ ( opencv ) を統合しようとしています。android.mkファイルに変更を加えました。しかし、私はまだopencvライブラリとQCARライブラリを同じファイル.cppで使用できません.Javaクラスにアクセスして、QCARを使用するファイルとOPENCVを使用するファイルをリンクしようとしましたが、このマッピングには時間がかかります. 同じファイルで 2 つのライブラリを使用する必要があります。これは私の 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
しかしopencv
、ImageTargets.cpp(既に使用している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
このファイルで何が間違っているのですか?