1

I am using this question accepted answer to build nonfree module of opencv 2.4.11. i am using windows 10 operating system.

1) I moved nonfree folder from OpenCV 2.4.11\sources\modules\nonfree\
include\opencv2\ to OpenCV-2.4.11-android-sdk\sdk\native\jni\include\opencv2

2) I have created the libnonfree folder and the jni folder inside the libnonfree folder. The nonfree_init.cpp, precomp.hpp, sift.cpp and surf.cpp files are in the jni folder.

3) I have also created the Android.mk and Application.mk script files.

4) Time to build the libnonfree.so change the cmd directory into the libnonfree and type ndk-build

Here is the complete error message.

Android NDK: ERROR:Android.mk:opencv_java: LOCAL_SRC_FILES points to a missing file Android NDK: Check that C:/Users/what/Desktop/OpenCV-android-sdk-build/sdk/native/jni/../libs/arm64-v8a/libopencv_java.so exists or that its path is correct C:/Users/what/AppData/Local/Android/sdk1/ndk-bundle/build//../build/core/prebuilt-library.mk:45: *** Android NDK: Aborting . Stop.

Here is also screenshot of my files and folders

Please help i have been stuck for to days to solve this problem.

Community
  • 1
  • 1
Yirga
  • 881
  • 1
  • 12
  • 31
  • 4
    Most likely your mistake was to build a 64-bit library, while your OpenCV dependency was only built for 32-bit ARM. Try to run `ndk-build APP_ABI=armeabi-v7a` – Alex Cohn Mar 18 '17 at 13:01
  • @AlexCohn I am using APP_ABI := armeabi-v7a in the Application.mk file. – Yirga Mar 18 '17 at 15:27
  • But your error message suggests that ndk-build is looking for arm64 library. Maybe it ignores Application.mk or there is some typo there. Please do me a favour, choose ABI on command line – Alex Cohn Mar 18 '17 at 16:13
  • Please run `ndk-build V=1` and post the complete build log – Alex Cohn Mar 18 '17 at 16:39
  • Right. Sorry I got distracted. Have you tried APP_ABI on command line? – Alex Cohn Mar 18 '17 at 17:03
  • Thanks i have solved my problem using the ndk-build APP_ABI := armeabi-v7a – Yirga Mar 18 '17 at 19:59
  • Are you using `externalNativeBuild` via gradle? That will ignore your `APP_ABI` setting, so you need to use `abiFilters` instead. – Dan Albert Mar 18 '17 at 19:59
  • No, the output should go to libnofree/libs/armeabi-v7a. Two files shoul be there: libopencv_java.so and your libnofree.so – Alex Cohn Mar 18 '17 at 20:00
  • It don't why but they are created in the ndk directory path libs\armeabi-v7a – Yirga Mar 19 '17 at 05:49
  • 1
    probably your Application.mk is wrong; also, if (as @DanAlbert commented above) you run an integrated ndk-build in Android Studio, it will override the build arguments and the destination. BTW, I notice something suspicious in your setup: Application.mk and Android.mk should be inside the jni directory, not above it! – Alex Cohn Mar 20 '17 at 15:19

0 Answers0