3
votes

I am trying to convert my project from SQLite.Net-PCL to sqlite-net-pcl (latest stable version; 1.3.1), as it says on Xamarin's working with databases, but when I install it, it has to install 40 packages (or so) as listed below

Microsoft.NETCore.Platforms 1.0.1
Microsoft.NETCore.Targets 1.0.1
runtime.native.System   4.0.0
SQLitePCLRaw.core 1.1.2
SQLitePCLRaw.bundle_green 1.1.2
System.Collections 4.0.11
System.Collections.Concurrent 4.0.12
System.Diagnostics.Debug 4.0.11
System.Diagnostics.Tools 4.0.1
System.Diagnostics.Tracing 4.1.0
System.Globalization 4.0.11
System.IO 4.1.0
System.IO.Compression 4.1.0
System.Linq 4.1.0
System.Linq.Expressions 4.1.0
System.Net.Http 4.1.0
System.Net.Primitives 4.0.11
System.ObjectModel 4.0.12
System.Reflection 4.1.0
System.Reflection.Extensions 4.0.1
System.Reflection.Primitives 4.0.1
System.Resources.ResourceManager 4.0.1
System.Runtime 4.1.0
System.Runtime.Extensions 4.1.0
System.Runtime.InteropServices 4.1.0
System.Runtime.Numerics 4.0.1
System.Text.Encoding 4.0.11
System.Text.Encoding.Extensions 4.0.11
System.Text.RegularExpressions 4.1.0
System.Threading 4.0.11
System.Runtime.InteropServices.RuntimeInformation 4.0.0
System.Threading.Tasks 4.0.11
System.Xml.ReaderWriter 4.0.11
System.Xml.XDocument 4.0.11
NETStandard.Library 1.6.0
sqlite-net-pcl 1.3.1

I understand that it needs some packages, but it seems like a lot of packages to me. I am using Xamarin.Forms version 2.3.3.180 (the latest stable)

And if I continue the installation, an error like this occurs

Could not install package 'System.Runtime.InteropServices.RuntimeInformation 4.0.0'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile111', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

How can I install sqlite-net-pcl, so I can continue working with SQLite on Android N?

Right now I have these targets

.NET Framework 4.5
Windows 8
ASP.NET Core 1.0 (I do not know why this is set)
Windows Phone 8.1 (I am not using this, but it says I have to reinstall all Nuget packages, if I want to remove it)
Xamarin.Android
Xamarin.iOS
Xamarin.iOS (Classic)
Xamarin.Mac (neither using this)

Do I have to remove the targets, that I am not using and reinstall all Nuget packages?

And I am using these NuGet packages

Acr.UserDialogs
ExifLib.PCL
Microsoft.NETCore.UniversalWindowsPlatform
MR.Gestures
Newtonsoft.Json
Xam.Plugin.Media
Xam.Plugins.Settings
Xamarin.Forms
Xamarin.Insights
Xamarin.UITest
XLabs.Forms
ZXing.Net.Mobile.Forms
4

4 Answers

7
votes

You have installed the .NetStandard version

Release Notes v1.3.1:

Switch to .NET Standard

As you can see NETStandard.Library 1.6.0 is now added as a package.

I would remove sqlite-net-pcl 1.3.1 and the other packages it installed for .NetStandard then use v1.2.1 as it still has the fix for Android N as it added bundle_green from here

v1.2.1: Update .raw to bundle_green 1.1.0

you can read more about the fix here

1
votes

I'm afraid that you will have to do what you said. I had a similar problem (luckily it was a new project) and I had no other way then doing this. You will have to remove every nuget package, change the target to remove the one that causes this error and then reinstall all packages. I would advise you to remove the targets one by one and try to install sqlite. You will be able to isolate the target that causes you error.

0
votes

I have ported that library to pure .NET Standard. I've reduced it down to one library that works on all platforms: android, iOS, uwp, etc, but I have removed the orm functionality. https://github.com/MelbourneDeveloper/SQLite.Net.Standard

NuGet: SQLite.Net.Standard

0
votes

I had the same issue. I resolved mine by first installing 'System.Runtime.InteropServices.RuntimeInformation 4.0.0' and than afterwards installing the SQlite-pcl package.