I am trying to use Sqlite4Java which has native dependencies for each platform: Windows, Linux, MacOS, Android.
Now gradle seems to download the java code because I can use import statement for Sqlite4Java classes. But where I try to open a database it tells me that the native library is missing.
[-91] cannot load library: java.lang.UnsatisfiedLinkError: no sqlite4java-linux-amd64-1.0.392 in java.library.path
Here is my dependencies statement
compile group: 'com.almworks.sqlite4java', name: 'sqlite4java', version: '1.0.392'
I would have expected that using the ‘group’ directive would have downloaded all the native libraries. That prevents me from specifiying each dependency manually like:
compile 'com.almworks.sqlite4java:libsqlite4java-linux-amd64:1.0.392'
Here is my version of gradle:
------------------------------------------------------------
Gradle 3.2.1
------------------------------------------------------------
Build time: 2012-12-21 00:00:00 UTC
Revision: none
Groovy: 2.4.8
Ant: Apache Ant(TM) version 1.9.9 compiled on March 1 2017
JVM: 1.8.0_181 (Oracle Corporation 25.181-b13)
OS: Linux 4.9.0-3-amd64 amd64
Backup Plan
If I cannot make gradle download the natives, what are my options?
A- Specify each native library in the dependencies in case ‘group’ is not working.
B- Download the files manually and place them in the projet. But how to I tell gradle to include those native files?
Any other solutions?
UPDATE:
I tried my solution A. It seems to download the files because I get the following messages:
Download https://jcenter.bintray.com/com/almworks/sqlite4java/libsqlite4java-linux-amd64/1.0.392/libsqlite4java-linux-amd64-1.0.392.pom
Download https://jcenter.bintray.com/com/almworks/sqlite4java/libsqlite4java-linux-amd64/1.0.392/libsqlite4java-linux-amd64-1.0.392.so
But I still get the same error that the file is missing.
I tried deleting the cache and rebuild it. It seems to download the files in:
$HOME/.gradle/caches/modules-2/files-2.1/com.almworks.sqlite4java/libsqlite4java-linux-amd64/1.0.392/5a97aa1b643252eb9be0901037cb440c2e145956
$HOME/.gradle/caches/modules-2/files-2.1/com.almworks.sqlite4java/libsqlite4java-linux-amd64/1.0.392/f5615fa33effc502ac72b65fc3c54459db117e5c
So the filename is just a hash number. Maybe it’s the reason it does not find it. Is gradle supposed to do something afterwards with this hash?