Issue with couchbase-lite-android when added through Maven

I am trying to add a dependency in an Android project using Maven. The dependency is Couchbase-lite for Android.

com.couchbase.lite couchbase-lite-android 1.2.1 aar

Now this creates an error as follows :-

05-16 18:19:23.711 26908-28389/com.x.x E/CouchLiteLog :﹕ Manager created
05-16 18:19:23.716 26908-28389/com.x.x E/Database﹕ Cannot load native library
05-16 18:19:23.716 26908-28389/com.x.x E/Database﹕ Cannot load native library
05-16 18:19:23.716 26908-28389/com.x.x E/art﹕ No implementation found for long
com.couchbase.lite.internal.database.sqlite.SQLiteConnection.nativeOpen(java.lang.String, int, java.lang.String, boolean, boolean) (tried Java_com_couchbase_lite_internal_database_sqlite_SQLiteConnection_nativeOpen and Java_com_couchbase_lite_internal_database_sqlite_SQLiteConnection_nativeOpen__Ljava_lang_String_2ILjava_lang_String_2ZZ)
05-16 18:19:23.726 26908-28389/com.x.x E/APP﹕ Unknown error Occured:
java.lang.UnsatisfiedLinkError: No implementation found for long com.couchbase.lite.internal.database.sqlite.SQLiteConnection.nativeOpen(java.lang.String, int, java.lang.String, boolean, boolean) (tried Java_com_couchbase_lite_internal_database_sqlite_SQLiteConnection_nativeOpen and Java_com_couchbase_lite_internal_database_sqlite_SQLiteConnection_nativeOpen__Ljava_lang_String_2ILjava_lang_String_2ZZ)
at com.couchbase.lite.internal.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
at com.couchbase.lite.internal.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:194)
at com.couchbase.lite.internal.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:178)
at com.couchbase.lite.internal.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:461)
at com.couchbase.lite.internal.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:191)
at com.couchbase.lite.internal.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:183)
at com.couchbase.lite.internal.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:814)
at com.couchbase.lite.internal.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:798)
at com.couchbase.lite.internal.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:693)
at com.couchbase.lite.storage.SQLiteStorageEngineBase.open(SQLiteStorageEngineBase.java:62)
at com.couchbase.lite.store.SQLiteStore.open(SQLiteStore.java:180)
at com.couchbase.lite.Database.open(Database.java:1150)
at com.couchbase.lite.Manager.openDatabase(Manager.java:335)
at com.couchbase.lite.Manager.getDatabase(Manager.java:299)
The problem seems to be with Maven project trying to figure out a .aar instead of a .jar.

The Couch Manager is getting created but during database = manager.getDatabase(dbname); it throws an exception. I have understood that SQLiteConnection.nativeOpen makes a jni level call and I found the .so files available in the libraries, but somehow the SQLiteConnection.class is not able to call it. Maybe the path is not referenced correctly? I have no idea. Also I am using IntelliJ Idea(I know!!).

This is working perfectly in a gradle Android project. Also I have tried to download the jars from the CouchBase site directly and then adding those jars from Module setting into the project, only to face the same issue.

UPDATE : couchbase-lite-android-sqlite-default is not getting added by default from dependency couchbase-lite-android. I added it seperately from Maven repo but still facing the same issue.

Please help me understand the problem. Thanks in advance!! :slight_smile:

To clarify, are you saying the .so files are bundled in the apk?

Info here might help: https://developer.android.com/training/articles/perf-jni.html#faq_ULE