Xamarin with Entity Framework Core: Error: unauthorized access to "/system/lib/libsqlite.so" on Android 7

entity-framework-core sqlite xamarin.android

Question

Im trying to create a Xamarin Forms App using the new Entity Framework Core. The app targets android 6.0 but my Emulator is running Android 7.0. I installed the following related Nuget packages on the android project:

  • Microsoft.EntityFrameworkCore --> 1.1.1
  • Microsoft.EntityFrameworkCore.Sqlite --> 1.1.1

When accessing my DbContext on Android a message will pop up telling: Detected problems with native libraries unauthorized access to "/system/lib/libsqlite.so".

This Xamarin forums thread suggests, that it's due to the native SqLite binaries are no longer supported (on Android 7?) and the common fix seems to be to switch to the SqLite.Net PCL.

However as Microsoft.EntityFrameworkCore.Sqlite depends on Microsoft.Data.Sqlite which in turn depends on the native SqLite package I cannot just replace this (or can I?)

Strangely enough, despite of the error message suggesting otherwise, the data access seems to work. At least migrations run and repeated writes to the database will create new Ids.

Of course I could just scrap EF Core but I guess a lot of people are looking into using it for Xamarin in the future. So it would be nice if anyone would find/know a fix.

1
3
4/3/2017 6:12:31 AM

Popular Answer

I had the same problem. I have fixed this using the following libs: sqlite-net-pcl (version 1.2.0), SQLitePCLRaw.bundle_green, SQLitePCLRaw.core, SQLitePCLRaw.lib.e_sqlite3.android, SQLitePCLRaw.provider.e_sqlite3.android.

1
4/3/2017 5:48:50 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow