I cannot add local native dependencies

I am using Sqlite4Java in my LibGDX project, and I am not using maven’s directory so I downloaded the library into my projects. If I add the natives manually from Eclipse it works. but everytime I refresh graddle, the natives gets removed. So I have to add them manually again. I thought it would be more convenient to add them to the gradle.build file, but I cannot manage to make it work.

The source code is added this way to the core project, this does not create any problems:

compile files('libs/sqlite4java.jar')

Then I tried to add the native libraries to the desktop project, none of the methods below works. Here is the example for a single native file:

natives files('libs/sqlite4java-linux-amd64.so')
natives "com.almworks.sqlite4java:libsqlite4java-linux-amd64:1.0.392"

In both cases, gradle fail to build. I tried:

compile files('libs/libsqlite4java-linux-amd64.so')

In that case, gradle build, but the execution fails with

cannot load library: java.lang.UnsatisfiedLinkError: no sqlite4java-linux-amd64 in java.library.path

If you have any clue or documentation to make it work, let me know.

I did additional search, I tried using this work around described below for both the android and desktop project, and still it cannot find the native file when launching the program.

Basically what you need to do is put your .so files inside a a folder named lib (Note: it is not libs and this is not a mistake). It should be in the same structure it should be in the APK file. In my case it was:

Project:
|–lib:
|–|–armeabi:
|–|–|–.so files.

So I’ve made a lib folder and inside it an armeabi folder where I’ve
inserted all the needed .so files. I then zipped the folder into a .zip (the structure inside the zip file is now lib/armeabi/.so) I renamed the .zip file into armeabi.jar and added the line compile fileTree(dir: ‘libs’, include: '.jar’) into dependencies {} in the gradle’s build file.