Importing OpenCV 4.X android SDK module into Android Studio
Android Studio 3.5
OpenCV Android SDK 4.1.1 and 4.1.2
I have followed numerous tutorials importing OpenCV 3.4.X Android SDK modules from source, but have not been able to do the same for OpenCV 4.X Android SDK modules. Has something changed that prevents this import?
The clues: After the import of opencv java folder into the AS project, I first noticed the usual gradle errors (seen in 3.4.X imports) did not appear. Also, when attempting to set up the dependency between the library and the app, I could not (ref: image).
Screenshots of the steps I take to import opencv module from source, then attempt to add the dependency to the app...
<updated with="" solution="">
For some reason, the build.gradle file of the imported OpenCV-4.X Android SDK contains some problematic bits. Once I corrected those, I could set the dependency correctly.
Main problem: first line of the OpenCV-4.X build.gradle file was apply plugin: 'com.android.application' when it should be apply plugin: 'com.android.library'. Correcting this and other items in the build.gradle file fixed the issue.
Thanks,
Rob