Strange Exception

None of these solutions are working for me. If this has been fixed, can we please get a hotfix pushed to nuget? It’s unacceptable to me that Couchbase Lite on Xamarin iOS has been straight up broken for over a month now.

Please advise.

1.2.1 has passed code freeze and is in testing as we speak. There are a few things you can try in the meantime:

  1. Temporarily downgrading your version of the library
  2. Building the release/1.2.1 branch of the repo (I hope that this will be automated soon. Unfortunately, the build team is tied up with other issues and I have no idea when this will happen)
  3. Building the 1.2.0.3 tag from source after removing these lines (yes I am aware of the irony of the comment in the URL…).

Hi @borrrden

I am getting this exception in android 7.0 and 7.1 nougat after updating couchbase nuget packages to 1.4.1 .

Can you help me with this.

Thanks in Advance.

Here is the stack trace.
android.runtime.JavaProxyThrowable: System.TypeInitializationException: The type initializer for ‘CloodeesV2.Common.Constant’ threw an exception. —> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> System.TypeInitializationException: The type initializer for ‘Couchbase.Lite.Storage.SystemSQLite.SqliteCouchStore’ threw an exception. —> System.DllNotFoundException: /system/lib/libsqlite.so
at (wrapper managed-to-native) SQLitePCL.SQLite3Provider_sqlite3+NativeMethods:sqlite3_libversion ()
at SQLitePCL.SQLite3Provider_sqlite3.SQLitePCL.ISQLite3Provider.sqlite3_libversion () [0x00000] in <4ca764dde1254feba227cd5a80885917>:0
at SQLitePCL.raw.sqlite3_libversion () [0x00000] in <4ca764dde1254feba227cd5a80885917>:0
at Couchbase.Lite.Storage.SystemSQLite.SqliteCouchStore…cctor () [0x0000a] in <7545aa770c4d4f2e9b84ff79e4386f39>:0
— End of inner exception stack trace —
at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00002] in <36e2a6d95c294a5c9df2bcda333e008b>:0
— End of inner exception stack trace —
at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00017] in <36e2a6d95c294a5c9df2bcda333e008b>:0
at System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic) [0x000a8] in <36e2a6d95c294a5c9df2bcda333e008b>:0
at System.RuntimeType.CreateInstanceSlow (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x00009] in <36e2a6d95c294a5c9df2bcda333e008b>:0
at System.RuntimeType.CreateInstanceDefaultCtor (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x00027] in <36e2a6d95c294a5c9df2bcda333e008b>:0
at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic) [0x00020] in <36e2a6d95c294a5c9df2bcda333e008b>:0
at System.Activator.CreateInstance (System.Type type) [0x00000] in <36e2a6d95c294a5c9df2bcda333e008b>:0
at Couchbase.Lite.Database.OpenWithOptions (Couchbase.Lite.DatabaseOptions options) [0x000e6] in :0
at Couchbase.Lite.Manager.OpenDatabase (System.String name, Couchbase.Lite.DatabaseOptions options) [0x0004d] in :0
at Couchbase.Lite.Manager.GetDatabase (System.String name) [0x0000f] in :0
at CloodeesV2.Common.Constant…cctor () [0x000db] in <74409cd4c8be43b2977eae75ea3a0741>:0
— End of inner exception stack trace —
at Android.Support.V4.App.FragmentActivity.n_OnCreate_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) [0x0000f] in <1e89c43d3c7d48b5ba69bfc0b1bdf114>:0
at (wrapper dynamic-method) System.Object:f0e66a45-155d-44d4-bdf8-78428ebd393f (intptr,intptr,intptr)
at md5ee9efbc4dce862a43f5fbe04755f6f2b.MainActivity.n_onCreate(Native Method)
at md5ee9efbc4dce862a43f5fbe04755f6f2b.MainActivity.onCreate(MainActivity.java:31)
at android.app.Activity.performCreate(Activity.java:6858)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2677)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2785)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1532)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:163)
at android.app.ActivityThread.main(ActivityThread.java:6337)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:880)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:770)

System SQLite cannot be used with Android 7.0 and above due to Google restrictions. You must add the Couchbase custom SQLite package from Nuget and register it as described in the repo read me.

Hi @borrrden

I am getting one new exception right now , the custom sqlite worked for me at that time but due to that package I am getting one new error in debug mode.

Here is the stacktrace :

03-24 17:16:50.933 I/MonoDroid( 6600): UNHANDLED EXCEPTION:
03-24 17:16:50.952 I/MonoDroid( 6600): System.TypeInitializationException: The type initializer for ‘CloodeesV2.Common.Constant’ threw an exception. —> System.MissingMethodException: Default constructor not found for type Couchbase.Lite.Storage.CustomSQLite.SqliteCouchStore
03-24 17:16:50.952 I/MonoDroid( 6600): at System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic) [0x0007b] in <178334ae903945438d3e4e7c1e0d790a>:0
03-24 17:16:50.952 I/MonoDroid( 6600): at System.RuntimeType.CreateInstanceSlow (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x00009] in <178334ae903945438d3e4e7c1e0d790a>:0
03-24 17:16:50.952 I/MonoDroid( 6600): at System.RuntimeType.CreateInstanceDefaultCtor (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x00027] in <178334ae903945438d3e4e7c1e0d790a>:0
03-24 17:16:50.953 I/MonoDroid( 6600): at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic) [0x0002c] in <178334ae903945438d3e4e7c1e0d790a>:0
03-24 17:16:50.953 I/MonoDroid( 6600): at System.Activator.CreateInstance (System.Type type) [0x00000] in <178334ae903945438d3e4e7c1e0d790a>:0
03-24 17:16:50.953 I/MonoDroid( 6600): at Couchbase.Lite.Database.OpenWithOptions (Couchbase.Lite.DatabaseOptions options) [0x000e6] in /Users/jenkins/jenkins/workspace/couchbase-lite-net-build@2/1.4.1/Android/couchbase-lite-net/src/Couchbase.Lite.Shared/Database.cs:2059
03-24 17:16:50.953 I/MonoDroid( 6600): at Couchbase.Lite.Manager.OpenDatabase (System.String name, Couchbase.Lite.DatabaseOptions options) [0x0004d] in /Users/jenkins/jenkins/workspace/couchbase-lite-net-build@2/1.4.1/Android/couchbase-lite-net/src/Couchbase.Lite.Shared/Manager.cs:397
03-24 17:16:50.953 I/MonoDroid( 6600): at Couchbase.Lite.Manager.GetDatabase (System.String name) [0x0000f] in /Users/jenkins/jenkins/workspace/couchbase-lite-net-build@2/1.4.1/Android/couchbase-lite-net/src/Couchbase.Lite.Shared/Manager.cs:414
03-24 17:16:50.953 I/MonoDroid( 6600): at CloodeesV2.Common.Constant…cctor () [0x0020c] in F:\xamarin\Cloodees\CloodeesV2\CloodeesV2\CloodeesV2\Common\Constant.cs:132
03-24 17:16:50.953 I/MonoDroid( 6600): — End of inner exception stack trace —
03-24 17:16:50.953 I/MonoDroid( 6600): at Android.Support.V4.App.FragmentActivity.n_OnCreate_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) [0x0000f] in <3284391edeec4a4c9d9499543f8c132d>:0
03-24 17:16:50.953 I/MonoDroid( 6600): at (wrapper dynamic-method) System.Object:9c2585ef-7a98-4032-8454-d14d953054a6 (intptr,intptr,intptr)

Can you help me with this.

Thanks in Advance.

HI @borrrden ,

Any update on this, I am really stuck with this.

Thanks.

It only happens in debug mode?

Hi @borrrden

Yes, it’s only happen in debug mode.

Thanks.

That stumps me, but I can only guess that it has something to do with some kind of strip settings going on. Can you analyze the differences in your android build settings between debug and release?

HI @borrrden ,

I have done nothing different, just changed mode from debug to release, nothing else.

System.MissingMethodException: Default constructor not found for type Couchbase.Lite.Storage.CustomSQLite.SqliteCouchStore

I guess this is the issue, but not sure hot to fix this.

Thanks.