LiteCore.Interop.ILiteCore issue


#1

Good morning. I am having trouble with something that I am unable to find a resolution. I have a sample Xamarin Multiplatform application using iOS and Android. The iOS application works fine but I get the following error when running the Android application (it compiles fine). It seems to be looking for “Couchbase.Lite.Support” in order to call the Activate() method but I cannot find the NuGet package that contains that reference. I have only added the Couchbase Lite NuGet package.

Thank you.

Brian


System.TypeInitializationException: The type initializer for ‘Couchbase.Lite.Sync.HTTPLogic’ threw an exception. —> System.TypeInitializationException: The type initializer for ‘Couchbase.Lite.Interop.Native’ threw an exception. —> System.InvalidOperationException: A required dependency injection class is missing (LiteCore.Interop.ILiteCore).
Please ensure that you have called the proper Activate() class in the
support assembly (e.g. Couchbase.Lite.Support.UWP.Activate()) or that you
have manually registered dependencies via the Couchbase.Lite.DI.Service
class.
at Couchbase.Lite.DI.Service.GetRequiredInstance[T] () [0x00027] in <53470bc754c24de1bd6595e9ba2c7369>:0
at Couchbase.Lite.Interop.Native…cctor () [0x00000] in <53470bc754c24de1bd6595e9ba2c7369>:0
— End of inner exception stack trace —
at Couchbase.Lite.Sync.HTTPLogic.GetUserAgent () [0x00152] in <53470bc754c24de1bd6595e9ba2c7369>:0
at Couchbase.Lite.Sync.HTTPLogic…cctor () [0x00000] in <53470bc754c24de1bd6595e9ba2c7369>:0
— End of inner exception stack trace —


#2

Did you call Activate in your Android project as the instructions say?


#3

What class does Support belong to? I cannot find it from Couchbase.Lite. That was my question — I am missing a reference but I don’t know which one.

Or what class is the Activate() method located?

Thank you for responding.


#4

When you install Couchbase.Lite on a Xamarin Android project you will also get the Couchbase.Lite.Support.Droid assembly as a dependency. The correct call is Couchbase.Lite.Support.Droid.Activate(ApplicationContext) for Android.


#5

Thank you. I attached a screenshot of the references. Are those the correct ones? If so, I’ll remove and then try getting them again from NuGet to see if it works then.

49%20AM


#6

Those are correct. The second one in the last has the class you are after.


#7

I see it now. I was trying to reference it from the shared code. Which prompts me to ask (I just posted a question about this). What are the best practices for the replicator? Should it start maybe at the App.xaml.cs file in order to be active while the application is running or does it need to be closed when leaving a screen and then restarted when opening another screen?

I hope that makes sense.