无法使用JNI代码编译android项目(未找到算法)

时间:2013-10-28 09:52:11

标签: android c++ eclipse opencv

我正在尝试使用一些JNI代码构建简单的Android应用程序。 我已经尝试了这个suggestion,但没有帮助

当我在eclipse中按下构建项目时,我收到此错误:

Description Resource    Path    Location    Type
fatal error: algorithm: No such file or directory   Tracker     line 56, external location: /home/slani/code/OpenCV-2.4.6-android-sdk/sdk/native/jni/include/opencv2/core/core.hpp  C/C++ Problem
make: *** [obj/local/armeabi/objs/detect_jni/detect_jni.o] Error 1  Tracker         C/C++ Problem

core.hpp中的第56行包含相关的include。

这是我的Android.mk文件jni文件夹:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

include /home/slani/code/OpenCV-2.4.6-android-sdk/sdk/native/jni/OpenCV.mk

LOCAL_MODULE    := detect_jni
LOCAL_SRC_FILES := detect_jni.cpp

include $(BUILD_SHARED_LIBRARY)

这是我在jni文件夹中的Aplication.mk文件:

APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions
APP_ABI := all
APP_PLATFORM := android-8

这是我的.cpp文件:

#include <jni.h>
#include <opencv/cv.h>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/features2d/features2d.hpp>

using namespace cv;

extern "C"{
    JNIEXPORT void JNICALL Java_com_slani_tracker_OpenCamera_findObject((JNIEnv *env, jlong addRgba, jlong addHsv);
    JNIEXPORT void JNICALL Java_com_slani_tracker_OpenCamera_findObject((JNIEnv *env, jlong addRgba, jlong addHsv)
    {

        Mat& rgba = *(Mat*)addRgba;
        Mat& hsv = *(Mat*)addHsv;

        cvtColor(rgba, hsv,CV_RGBA2HSV);

    }
}

This is path to my ndk-build

This is my path and symbols in eclipse

有人可以帮帮我吗?可能导致这个问题的原因是什么?

由于

1 个答案:

答案 0 :(得分:2)