Using Android ADT
am trying to static initialize openCV so it included in the app build and users don't have to download openCV Manager from the Android playstore.
Am using openCV v3 (http://opencv.org/downloads.html)
At the stage just trying to add static initialization to one of the samples in OpenCV-android-sdk\samples\face-detection.
I have followed the example (http://docs.opencv.org/2.4/doc/tutorials/introduction/android_binary_package/dev_with_OCV_on_Android.html)
Looked at lots of examples but as yet come up with no solution to getting it working. Very much hope someone might be able to help.
I did think might be due to libopencv_java3.so not being in the folder libs/armeabi-v7a/
When i copy and paste it from OpenCV-android-sdk\sdk\native\libs\armeabi-v7a
it disappears. I believe this could be something to do with the way the ndk is setup. Of course the issue could be something completely different.
LogCat gives this:
11-26 16:36:33.647: D/OpenCV/StaticHelper(13993): Trying to load library opencv_java3
11-26 16:36:33.647: D/OpenCV/StaticHelper(13993): Cannot load library "opencv_java3"
11-26 16:36:33.647: W/System.err(13993): java.lang.UnsatisfiedLinkError: Couldn't load opencv_java3 from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/org.opencv.samples.facedetect-1.apk"],nativeLibraryDirectories=[/data/app-lib/org.opencv.samples.facedetect-1, /vendor/lib, /system/lib, /vendor/lib]]]: findLibrary returned null
11-26 16:36:33.767: D/OpenCV/StaticHelper(13993): Trying to load library opencv_java3
11-26 16:36:33.767: D/OpenCV/StaticHelper(13993): Cannot load library "opencv_java3"
11-26 16:36:33.767: W/System.err(13993): java.lang.UnsatisfiedLinkError: Couldn't load opencv_java3 from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/org.opencv.samples.facedetect-1.apk"],nativeLibraryDirectories=[/data/app-lib/org.opencv.samples.facedetect-1, /vendor/lib, /system/lib, /vendor/lib]]]: findLibrary returned null
incase someone comes across this issue and uses AndroidStudio. You can fix it by simply copying the folder OpenCV-android-sdk\sdk\native\libs
into your OpenCvProject/openCVLibrary310/source/main and rename it to jniLibs. So that the final structure looks like this: OpenCvProject/openCVLibrary310/source/main/jniLibs/
If you already ran your project out of AndroidStudio make sure to delete it first from the device. Otherwise AndroidStudio might not redeploy it and because of that might not copy over the libs.
It might also work if you copy the libs into your actual project and not into the openCVLibrary folder but I didn't try that.
Ensure you have the option to install modules set to "ON" before including Opencv.mk:
OPENCV_INSTALL_MODULES:=on
include ${OPENCV_ANDROID_SDK}/${ANDROID_SDK_JNI}/OpenCV.mk
I already set my variables in my makefile
see: http://docs.opencv.org/2.4/doc/tutorials/introduction/android_binary_package/dev_with_OCV_on_Android.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With