Ask Your Question

steveliles's profile - activity

2016-02-06 06:25:36 -0500 received badge  Good Answer (source)
2016-01-25 20:20:21 -0500 received badge  Nice Answer (source)
2016-01-25 07:56:04 -0500 received badge  Teacher (source)
2016-01-25 07:17:17 -0500 received badge  Necromancer (source)
2016-01-25 03:26:04 -0500 answered a question OpenCV on Android without the OpenCV Manager

Since 2012 we've been bundling the native libs in our apps - it works great, and offers a much better end user experience than the OpenCV Manager (and for that matter a better developer experience).

You can get the native libs from inside the OpenCV4Android download and add them to your own project directly or bundle them in your own .aar. I'm sure you are aware of that Eric (nice book btw)., but others who come across this question may not realise it.

Steps:

  • Download and unpack OpenCV4Android
  • Create a library project in Android Studio
  • Copy the Java src from OpenCV4Android into your libraries /src/main/java directory
  • Copy the native lib directories into /src/main/jniLibs
  • Depend on your new library

If you want to reduce the download size of dependent apps, add a 'splits' directive to the 'android' gradle plugin configuration - something like this:

android {
   // ... 
   splits {
     abi {
       enable true
       reset()
       include 'x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'mips', 'mips64', 'arm64-v8a'
       universalApk false
     }
   }
}

I cannot understand why anyone would think the OpenCV Manager approach is OK, never mind push it to the exclusion of the better alternative.

Producing a .aar is very easy, and having it published to maven central and jcenter also very easy. I suspect having an official .aar available and documented as the straight-forward integration route would do wonders for OpenCV usage on Android!

2016-01-25 02:47:56 -0500 received badge  Supporter (source)