Fatal Exception: java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app/.../lib/arm64/libLiteCore.so" .dynamic section header was not found... at com.couchbase.lite.internal.CouchbaseLiteInternal.init(CouchbaseLiteInternal.java:93)

Using

com.couchbase.lite:couchbase-lite-android-ee-ktx:3.1.7

Found crash on Xiaomi Poco F3, Android 13 as the screenshot below;

Here is the application crash log:

Fatal Exception: java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app/~~iAt9PlPGdXAO5jSIBGcYhQ==/com.tdcm.trueidapp-J0fQBYuPGxAcZFZSLlukOA==/lib/arm64/libLiteCore.so" .dynamic section header was not found
       at java.lang.Runtime.loadLibrary0(Runtime.java:1082)
       at java.lang.Runtime.loadLibrary0(Runtime.java:1003)
       at java.lang.System.loadLibrary(System.java:1661)
       at com.couchbase.lite.internal.CouchbaseLiteInternal.init(CouchbaseLiteInternal.java:93)
       at com.couchbase.lite.CouchbaseLite.init(CouchbaseLite.java:62)
       at com.couchbase.lite.CouchbaseLite.init(CouchbaseLite.java:46)
       at com.couchbase.lite.CouchbaseLite.init(CouchbaseLite.java:37)
       at com.x.common.share.couchbase.CouchbaseManager.<init>(CouchbaseManager.kt:33)
       at com.x.common.share.couchbase.di.CouchbaseModule.provideCouchbaseManager(CouchbaseModule.kt:15)
       at com.x.common.share.couchbase.di.CouchbaseModule_ProvideCouchbaseManagerFactory.provideCouchbaseManager(CouchbaseModule_ProvideCouchbaseManagerFactory.java:50)
       at com.x.common.share.couchbase.di.CouchbaseModule_ProvideCouchbaseManagerFactory.get(CouchbaseModule_ProvideCouchbaseManagerFactory.java:40)
       at com.x.common.share.couchbase.di.CouchbaseModule_ProvideCouchbaseManagerFactory.get(CouchbaseModule_ProvideCouchbaseManagerFactory.java:13)
       at dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
       at com.x.common.share.couchbase.injections.DaggerCouchbaseComponent$CouchbaseSubComponentImpl.couchbaseManager(DaggerCouchbaseComponent.java:55)
       at com.x.common.share.couchbase.injections.DaggerCouchbaseComponent$CouchbaseSubComponentImpl.couchbaseManager(DaggerCouchbaseComponent.java:65353)
       at com.x.features.home.injections.DaggerHomeComponent$HomeComponentImpl.mainViewModel(DaggerHomeComponent.java:766)
       at com.x.features.home.injections.DaggerHomeComponent$HomeComponentImpl.injectMainActivity(DaggerHomeComponent.java:1074)
       at com.x.features.home.injections.DaggerHomeComponent$HomeComponentImpl.inject(DaggerHomeComponent.java:1008)
       at com.x.features.home.injections.DaggerHomeComponent$HomeComponentImpl.inject(DaggerHomeComponent.java:65334)
       at com.x.features.home.MainActivity.onCreate(MainActivity.kt:65282)
       at android.app.Activity.performCreate(Activity.java:8516)
       at android.app.Activity.performCreate(Activity.java:8480)
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1418)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3806)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3971)
       at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
       at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2389)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loopOnce(Looper.java:210)
       at android.os.Looper.loop(Looper.java:299)
       at android.app.ActivityThread.main(ActivityThread.java:8261)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:559)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:954)
        

I have seen this before but only very rarely and mostly on Android 7.
Our packaging of the native libraries works on most devices.

I would love to get my hands on a way to drive the issue reliably.

I suggest you try adding:

   packagingOptions{
        doNotStrip "**/*.so"
   }

…to the “android” clause of the build.gradle file. That has sometimes helped in other cases.
It may result in a very large binary… you may not want to do it for all devices.