SQLite User Forum

System.Data.SQLite (.NET) on Xamarin Android
Login

System.Data.SQLite (.NET) on Xamarin Android

(1) By murali (muralitharan) on 2022-08-24 07:15:47 [link] [source]

Hi, 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.

How can I solve this? Anyone has find this error too?

Thank you!

(2) By Chris Locke (chrisjlocke1) on 2022-08-24 13:26:17 in reply to 1 [source]

I've seen this in winforms .net development when the x86 and x64 directory structure hasn't been correctly set, but I assume on Android that doesn't apply, but you've got that file on the Android system, yes? In the same directory as the application, or in a x86/x64 directory?

(3) By Stephen Lombardo (sjlombardo) on 2022-08-25 13:17:55 in reply to 1 [link] [source]

System.Data.Sqlite doesn't include a native interop library for Android. You can instead use Microsoft.Data.Sqlite for on Xamarin/MAUI apps that target iOS or Android. That NuGet package includes a dependency on a SQLitePCLRaw bundle, which will in turn automatically bring in the correct native libraries for each each supported platform.