I am creating a new Xamarin (iOS+Android) project which has common code in a PCL. I’m not sure but I think that PCL support may have recently been added to Couchbase, according to this bug on github from last year: https://github.com/couchbase/couchbase-lite-net/issues/5
However, when I try to add the Couchbase Lite 126.96.36.199 package in Xamarin Studio, I get the following:
Could not install package ‘Couchbase.Lite 188.8.131.52’. You are trying to install this package into a project that targets ‘portable-net45+win+wp80+MonoTouch10+MonoAndroid10+xamarinmac20+xamarinios10’, 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.
I am using Profile 78 and tried changing my profile to something compatible with Couchbase Lite but for the life of me I can’t figure out how to determine which profile Couchbase is using or if it even supports PCL at all. So my question is: Does Couchbase Lite support PCL? If so, what profile? If not, what is the suggested way to use Couchbase Lite in a PCL project?
CB Lite is not supported for Windows Phone and Windows Store, therefore you would need to use a PCL profile without “win+wp80”.
The easiest way to add CB Lite to an iOS + Android project is to use a shared library and add CB lite to iOS and Android individually.
For inspiration you can use this Xamarin Forms app:
Thanks @martinesmann. I’m looking into the ToDoLite Forms project. But, I would prefer not to use a shared project if I don’t have to. Do you know which exact profile number CBL supports? I have tried 24, 7, 78, 111… Xamarin Studio will not allow me to select just .NET 4.5 and Xamarin.* (leaving Window Phone, Silverlight 5, Windows 8, WIndows Phone Silverlight 8, and WIndows Store UNCHECKED). It says:
Found multiple applicable frameworks, you need to select additional check boxes.
Does anyone know if CBL plans on adding support for Windows Phone, more specifically Profile 78 (which is the standard profile for Xamarin)?
The plan is there but in no short timeframe. Supporting Windows Phone / RT with our current code base is no small amount of work. Once that is done we will likely be able to support PCL through a technique called “bait and switch.” Anyway it would be nice to have it this year but there are no guarantees on that.
Thanks for the response. I can imagine it’s a lot of work but it will be a nice feature for an already great product. I think I have something implemented that will let me upgrade once you have PCL support. I made an interface in my PCL which I am then implementing in a Shared project similar to ToDoLite. That way I achieve my goal of not repeating the Couchbase code in the platform specific projects and the rest of my PCL code can still utilize it through the interface.
It’s almost end of year 2016, and I am not able to add it to PCL. It gives me this error
Could not install package ‘Couchbase.Lite.Storage.SystemSQLite 1.3.1’. You are trying to install this package into a project that targets ‘.NETPortable,Version=v4.5,Profile=Profile259’, 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.
Does this mean that the Couchbase.Lite-PCL (184.108.40.206) package is a dead end? I get an error in Visual Studio 2015 cross-platform (xamarin) project as soon as I start using any of the Couchbase classes in the code.
Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly ‘Stateless, Version=220.127.116.11, Culture=neutral, PublicKeyToken=93038f0927583c9a’. Perhaps it doesn’t exist in the Mono for Android profile?
@borrrden so what’s the best option today (Dec 2016) for using Couchbase.Lite in a Xamarin.Forms project? The Component in Xamarin store has not been updated since Feb 2016. Should I use the shared project approach recommended in the ToDo project?
Yes, that is the only option as far as I know. The component on the Xamarin store is just a wrapper for Nuget anyway. I am making it a strong goal to incorporate UWP support into the 2.0 release of Couchbase Lite, and as an effect of that it will be much more comparable to what I will need to do to get a portable library going (in the form of .NET Standard). 2.0 is going to shed a large swatch of C# area as we move the storage functionality to the native side (C++) and some of the problems associated with using the portable API subset will disappear with that. I know our portability story is not great, but I’m not ignoring it.
Given that CouchbaseLite may undergo significant changes, at this point does it make sense to use CBLite for NoSQL options? Will the new version maintain backward compatibility with current version? I dont want to get into a situation where I cannot migrate existing database when the new version is release.