使用opencv构建ndk时出现此错误。 文件(abc.cpp和def.cpp)存在于jni文件夹中,其名称正确,但始终出现此错误。
$ ndk-build
Android NDK: ERROR:/cygdrive/d/mySharedLibrary/jni/Android.mk:opencv_java: LOCAL_SRC_FILES points to a missing file
Android NDK: Check that D:/Development/OpenCV-2.4.9-android-sdk/sdk/native/jni/.
./libs/arm64-v8a/libopencv_java.so exists or that its path is correct
/cygdrive/d/Development/android-ndk-r10e/build/core/prebuilt-library.mk:45: ***
Android NDK: Aborting . Stop.
这是我的Android.mk
LOCAL_PATH:= $(调用my-dir)
包括$(CLEAR_VARS)
#OPENCV_CAMERA_MODULES:=off
#OPENCV_INSTALL_MODULES:=off
#OPENCV_LIB_TYPE:=SHARED
override OPENCV_INSTALL_MODULES:=on
#$(info SHINU $(OPENCV_INSTALL_MODULES))
include D:/Development/OpenCV-2.4.9-android-sdk/sdk/native/jni/OpenCV.mk
LOCAL_SRC_FILES := abc.cpp
LOCAL_SRC_FILES += def.cpp
LOCAL_C_INCLUDES += $(LOCAL_PATH)
LOCAL_MODULE := abcd
LOCAL_LDLIBS += -llog
include $(BUILD_SHARED_LIBRARY)
文件夹结构
D:\mySharedLibrary\jni
Android.mk
abc.cpp
abc.h
def.cpp
def.h
修改 问题从这里解决了。
这是我的Application.mk文件
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions
APP_ABI := arm64-v8a
APP_PLATFORM := android-8
我改变了
APP_ABI:= arm64-v8a
至
APP_ABI:= armeabi-v7a