How can I add a dylib to a project dependenies

I’m trying to use opencv. I installed and compiled it for java using Brew and I’ve found the library files. The files are libopencv_java2410.dylib and opencv-2410.jar.

the jar is simple to add using - compile fileTree(dir: ‘libs’, include: [’*.jar’]) However I can’t figure out how to attach the native dylib to the jar.

I get the error Exception in thread “main” java.lang.UnsatisfiedLinkError: no opencv_java2410 in java.library.path when running the project through gradle

I know the libraries work as if I add them manually to the ide and run it without gradle everything runs smoothly.

Note this is a plain java project. NOT android.