Android 7 Nougat Crash on CBL


#1

hi
after update my nexus5x to new Android Nougat, any app that use CBL crash on db initialize
any suggestion ?

version :
compile ‘com.couchbase.lite:couchbase-lite-android:1.3.0’

library “/system/lib/libsqlite.so” ("/system/lib/libsqlite.so") needed or dlopened by “/data/app/…-1/lib/arm64/libcom_couchbase_touchdb_TDCollateJSON.so” is not accessible for the namespace: [name=“classloader-namespace”, ld_library_paths="", default_library_paths="/data/app/…-1/lib/arm64:/system/fake-libs64:/data/app/…-1/base.apk!/lib/arm64-v8a", permitted_paths="/data:/mnt/expand"]

E/TDCollateJSON: Failed to find sqlite3_create_collation: undefined symbol: sqlite3_create_collation

android.database.sqlite.SQLiteException: no such collation sequence: REVID (code 1): , while compiling: SELECT doc_id, MIN(revid), MAX(revid) FROM revs GROUP BY doc_id


#2

I’m definitely not an Android expert, but I know that starting in Nougat, apps are no longer allowed to link to native system libraries like sqlite. That sort of explains the link error.

I thought we’d updated 1.3 to include our own copy of SQLite, but it’s entirely possible I’m wrong, or that using that library requires some changes to your build configuration. I hope @hideki or another Android-savvy person here can answer soon.


#3

Hi @hrs7000,

As @jens described in previous message, from Android N, Android does not allow the application to use native libraries which are provided by Android OS. From CBL v1.3.0, CBL provides SQLite library that is compiled by Couchbase. CBL v1.3.0 or higher should not load system library. But, from your log message, the application/couchbase lite loads SQLite library from system directory.

Following is my recommendation, please check couchbase-lite-android dependency in build.gradle file. And also delete gradle cache directly where dependent libraries are downloaded by gradle (~/.gradle/caches).

Note: Any application with CBL v1.2.x does not work with Android N.

Thanks,


#4

thanks @jens & @hideki
its work now , just need couple of rebuild in dependency modules