SQLite.Net on android 7+

Hello

I spent some time figuring this out and thought id share mty way around it, ugly as it may be.
So SQLite.Net doesnt work on androind 7 and above due to permissions, resulting in an error about a sqlite dll not being present.

the popular solution to this was to user sqlite-net-pcl (praeclarum/sqlite-net) which would have worked fine but i needed to utilize the IBlobSerializer interface to serialize some unknown complex types so was forced to use the SQLite.Net-PCL library (oysteinkrog/SQLite.Net-PCL)

So, first off i tried to install the SQLite.Net.Platform.XamarinAndroidN package to take care of this issue but as it turns out this isnt packaged correctly so couldnt be installed on xamarin.android, where i needed it.
It could however be installed on .net standard so i installed it there and copied the dll to my android project where i added it as a reference and referenced the new androidN platform in my SQLConnection ctor.
I then had to include a reference to Mono.Data.SQLite
after that it worked

So if like me you NEED SQLite.Net-PCL
* Install SQLite.Net.Platform.XamarinAndroidN on Standard/PCL project
* Take the dll from the package directory
* Add it to the android project file system
* Add it as a reference
* Add a reference to Mono.Data.SQLite

Sign In or Register to comment.