1

I have a project that uses the NuGet package System.Data.Sqlite for accessing the DB.

At compile time all works fine, but at runtime when I initialize the connection this error occurs:

System.DllNotFoundException: SQLite.Interop.dll

I have tried to install the NuGet package System.Data.SQLite.Core but nothing changed.

This error occurs only in Android and iOS device, on UWP all works fine.

How can I solve this?

Anyone has find this error too?

Here a sample project.

Thank you!

Edit:

In that post proposed as solution the package used is sqlite-net-pcl, I use a different package, the System.Data.Sqlite.

This is the package that I use: https://www.nuget.org/packages/System.Data.SQLite

Edit 2:

I've tried to use https://www.nuget.org/packages/sqlite-net-pcl/ and works, but I need to test also https://www.nuget.org/packages/System.Data.SQLite that doesn't works.

Hikari
  • 589
  • 7
  • 29
  • 1
    Possible duplicate of [System.DllNotFoundException: /system/lib/libsqlite.so- Xamarin Forms](https://stackoverflow.com/questions/52052631/system-dllnotfoundexception-system-lib-libsqlite-so-xamarin-forms) – FreakyAli Apr 04 '19 at 08:03
  • Hi, in that post the package used is sqlite-net-pcl, I use a different package, the System.Data.Sqlite. – Hikari Apr 04 '19 at 08:14
  • You are using this right https://github.com/haf/System.Data.SQLite – FreakyAli Apr 04 '19 at 08:23
  • This one https://www.nuget.org/packages/System.Data.SQLite – Hikari Apr 04 '19 at 08:31
  • Check this https://sqlite.org/android/doc/trunk/www/index.wiki – FreakyAli Apr 04 '19 at 09:46

1 Answers1

0

I solved using Microsoft.Data.SQLite https://www.nuget.org/packages/Microsoft.Data.SQLite

Hikari
  • 589
  • 7
  • 29
  • Here's a link explaining the difference between: System.Data.SQLite and Microsoft.Data.Sqlite (also mentions Mono.Data.Sqlite) https://learn.microsoft.com/en-us/dotnet/standard/data/sqlite/compare – Rauland Feb 23 '20 at 11:57
  • Here are some more interesting links about Microsoft.Data.Sqlite. Interoperability with the native SQLite library (uses SQLitePCLRaw): https://learn.microsoft.com/en-us/dotnet/standard/data/sqlite/interop – Rauland Feb 23 '20 at 12:07
  • And that it's used by the EF Core provider for SQLite: https://learn.microsoft.com/en-us/dotnet/standard/data/sqlite/?tabs=netcore-cli SQLite EF Core Database Provider: https://learn.microsoft.com/en-us/ef/core/providers/sqlite/?tabs=dotnet-core-cli – Rauland Feb 23 '20 at 12:09