Android"没有这样的文件或目录"错误?

时间:2013-08-07 06:35:17

标签: android opencv android-ndk

安装ADT并添加CDT和NDK并添加OpenCV库之后 出现此错误

**** Build of configuration Default for project OpenCV Tutorial 2 - Mixed Processing     ****

C:\android-ndk-r9\ndk-build.cmd 
jni/Android.mk:5: ../../sdk/native/jni/OpenCV.mk: No such file or directory
make: *** No rule to make target `../../sdk/native/jni/OpenCV.mk'.  Stop.

**** Build Finished ****

这是Android.mk代码

    LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

include ../../sdk/native/jni/OpenCV.mk

LOCAL_MODULE    := mixed_sample
LOCAL_SRC_FILES := jni_part.cpp
LOCAL_LDLIBS +=  -llog -ldl

include $(BUILD_SHARED_LIBRARY)

3 个答案:

答案 0 :(得分:9)

更改Android.mk,以便include包含OpenCV.mk的绝对路径。例如:

WIN: include d:\dev\OpenCV-2.4.6-android-sdk\sdk\native\jni\OpenCV.mk
Linux: include ~/mydevdir/OpenCV-2.4.6-android-sdk/sdk/native/jni/OpenCV.mk

答案 1 :(得分:0)

代码不在预期的位置。期望OpenCV.mk文件存在于目录../../sdk/native/jni/OpenCv.mk

答案 2 :(得分:0)

您是否知道使用include时,相对路径从项目目录开始,而不是project / jni目录。确保您的目录结构如下所示

  • - sdk

    - 项目

和您的包含行:

include ../sdk/native/jni/OpenCV.mk