I'm trying to setup Android Studio with Opencv by following this tutorial outlined here: https://www.youtube.com/watch?v=OTw_GIQNbD8
I can get the result obtained by the person giving the tutorial but upon trying to actually use some of Opencv's functions I run into some trouble.
I am able to load the Opencv library but upon trying use some of the native functions such as "Imgcodecs.imread" I get the error: ".lang.UnsatisfiedLinkError: No implementation found for long org.opencv.imgcodecs.Imgcodecs.imread_1(java.lang.String)"
I believe I have tracked down the issue to the following:
[![enter image description here]]
It seems that Android Studio is unable to detect the native C++ code which I'm guessing should be picked up from jniLibs folder I now have in app/src/main?
I've tried updating Android Studio to the latest stable build and I have fixed my file paths for my android SDK and NDK as having white-space can apparently affect the running of native code. The issue still persists.
I have been trying to fix this for the last 4 hours, any help would be greatly appreciated!
FINAL EDIT: I've made a tutorial explaining how to install Opencv for Android along with SIFT/SURF algorithms - https://www.youtube.com/watch?v=cLK9CjQ-pNI
It appears that I have solved my issue with using the following file structure and dependencies. I can't say for sure how I got it to work but I believe if you copy my structure here then yours should work too.
Ensure that there are no spaces present in your file path to your Android SDK or NDK. Android Studio warns that this may cause issue when loading native code.
Place the folders containing the '*.so' files into /YOUR_PROJECT_ROOT/libs (You'll probably have to manually create this libs folder). All the other solutions online stating to put them into app/src/main/jniLibs did not work for me.
To include the openCVLibrary300, I imported it as a module using File->New->Import Module, the set the Source Directory to something like ..\OpenCV-android-sdk\sdk\java
Ensure build.gradle files in both the app and the imported library share the same min and max sdk version etc.
Sample code used to test - http://pastebin.com/2zzU5B9G
The sample code I've posted above ensures the libraries are loaded before using Opencv methods. It uses the Imgcodecs.imread() function that uses native code in C++ that was previously giving me the ".lang.UnsatisfiedLinkError: No implementation found for long org.opencv.imgcodecs.Imgcodecs.imread_1(java.lang.String)" error.