Reputation: 348
I've been struggling with this for 4 hours now and I'm now turning in circles. I'm trying to get Akavache to run for my project. The project is a out-of-the-box Xamarin Forms (Portable) type. Then using Nuget I added Akavache 4.1.2 (which also added Akavache Core and SqlLite3 as well as ReactiveUI and Splat). I then updated Splat because the dependency in the nuget package is wrong (was 1.3.3 but should have been 1.6.0). But still I'm getting an error launching this app (targeting iOS for now) when adding the first line that you should have to target this (BlobCache.ApplicationName = "MyApp"):
System.TypeInitializationException: The type initializer for 'Akavache.BlobCache' threw an exception. ---> System.Exception: Failed to initialize Akavache properly. Do you have a reference to Akavache.dll?
at Akavache.Sqlite3.Registrations.Register (IMutableDependencyResolver resolver) [0x0001f] in <filename unknown>:0
at Akavache.DependencyResolverMixin.InitializeAkavache (IMutableDependencyResolver This) [0x000c0] in <filename unknown>:0
at Akavache.BlobCache.<.cctor>b__0 () [0x0000d] in <filename unknown>:0
at Splat.Locator.RegisterResolverCallbackChanged (System.Action callback) [0x00039] in <filename unknown>:0
at Akavache.BlobCache..cctor () [0x00018] in <filename unknown>:0
PS Running VS 2015 Community with Xamarin 4.1.0
Upvotes: 2
Views: 2080
Reputation: 33993
While not explicitly mentioned in the documentation of Akavache, normally it is required to install NuGet packages not only on your PCL but also on your platform specific projects.
This is mostly due to platform specific implementations that are needed. So although you are installing the same DLL another actual DLL - specifically for that platform - is added.
In some cases it is needed to do some sort of initialise call in the platform-specific project, although this does not seem to be the case here.
Upvotes: 5