Search code examples
sqlitexamarin.formsazure-mobile-servicesakavache

Azure MobileServices and Akavache


I'm build a xamarin forms app using Azure Mobile Services for offline sync - versions are:

  • Microsoft.Azure.Mobile.Client 3.1.0
  • Microsoft.Azure.Mobile.Client.SQLiteStiore 3.1.0
  • SQLitePCL 3.8.7.2
  • SQLitePCLRaw.bundle_green 1.1.2
  • SQLitePCLRaw.core 1.1.2

This was working fine, until I added akavache (5.0.0) to my project, before adding any akavache specific code, I ran the project and found

MobileServiceSQLiteStore store = new MobileServiceSQLiteStore(path);

was throwing an TyleLoadException:

Could not load type 'SQLitePCL.SQLite3Provider_internal' from assembly 'SQLitePCLRaw.provider.internal, Version=1.0.0.0, Culture=neutral, PublicKeyToken=89ae75803b2c608d'.

Has anyone come across this before? When I remove akavache, everything returns to normal.


Solution

  • Yeah I faced this problem for the longest time also. Unfortunately the package dependencies between Azure MobileServices and Akavache on Sqlite conflict. When I install the NuGet packages for Mobile Services, it installs different versions of the libraries you have listed above:

    Installed in my project

    • SQLitePCLRaw.bundle_green" version="1.0.0"
    • SQLitePCLRaw.core version="1.0.0

    The problem is that Akavache installs additional packages and upgrades some of your SQLite packages. Other people have reported problems using Azure Mobile App with Akavache.

    I would recommend trying out something else as your persistent Key-Store like the SecureStorage Xamarin Plugin Component or maybe Xamarin.Auth works if you just need to store a user account with data.