Couchbase.Lite.Sync.HTTPLogic Exception


#1

Hello. I am a beginner to xamarin and couchbase. I am making a project of my own, but I have a problem when trying to create a database with this line:
var database = new Database(“mydb”);

I am running couchbase lite 2.0.3 in Visual Studio version 15.7.2.
It makes the app crash. If I debug the program then the following exception occurs:
The type initializer for ‘Couchbase.Lite.Sync.HTTPLogic’ threw an exception.

I have searched at google, but without any luck.

best regards


#2

You should set the debugger to halt on exceptions, or enable text logging to get more information about the exception. Usually when it is an error like that it is because you didn’t activate the platform support classes though:

Couchbase.Lite.Support.<Platform>.Activate() where Platform is your app platform (iOS / Droid) needs to be called on startup.


#3

Thanks for the reply!

I solved the problem by entering the following in the OnCreate method in MainActivity.cs:
Couchbase.Lite.Support.Droid.Activate(this);