1

I've been trying to build the opencv nonfree libraries for a while, when calling the ndk-build function it aborts with this error

Android NDK: ERROR:jni/Android.mk:opencv_java: LOCAL_SRC_FILES points to a missing file
Android NDK: Check that /03-Projects//WorkSpace//OpenCV-2.4.11-android-sdk//OpenCV-android-sdk//sdk//native//jni//../libs/armeabi/libopencv_java.so exists or that its path is correct
C:/android-ndk-r11c/build//../build/core/prebuilt-library.mk:45: ***
Android NDK: Aborting.  Stop.

I've followed this tutorial:Tutorial - part 1: Using OpenCV Nonfree Module (SIFT, SURF) in Android NDK Projects
I've also tried the solution provided here by Kornel: Kornel's solution for building nonfree

Here's my files hierarchy: app -> src -> main -> jni

and here's my Android.mk file

LOCAL_PATH  := $(call my-dir)
OPENCV_PATH := D:\\03-Projects\\WorkSpace\\OpenCV-2.4.11-android- sdk\\OpenCV-android-sdk\\sdk\\native\\jni

include $(CLEAR_VARS)
OPENCV_INSTALL_MODULES := on
OPENCV_CAMERA_MODULES  := off
include $(OPENCV_PATH)\\OpenCV.mk

LOCAL_C_INCLUDES :=             \
  $(LOCAL_PATH)             \
  $(OPENCV_PATH)/include

LOCAL_SRC_FILES :=              \
  nonfree_init.cpp          \
  sift.cpp                  \
  surf.cpp

LOCAL_MODULE := nonfree
LOCAL_CFLAGS := -Werror -O3 -ffast-math
LOCAL_LDLIBS := -llog -ldl

include $(BUILD_SHARED_LIBRARY)

I'm trying to build the ndk with APP_ABI set for both:

x86 armeabi-v7a

Community
  • 1
  • 1
Lisa.s
  • 77
  • 1
  • 13

1 Answers1

0

Problem Solved: it turns out that I'm building the ndk project inside a folder under the "main" of an android studio project, which for some reasons wasn't working.
I moved the folder into into another directory not belongs to any android project and problem was solved.
although I've faced some other different problems later, but all were also sloved, and I'll soon provide a step-by-step solution on how to build nonfree modules for newer versions of opencv than the mentioned in the tutorials above.

Lisa.s
  • 77
  • 1
  • 13