34562

“Cannot add the libraries to incompatible component” when adding JSON.NET to Xamarin project

Question:

I got this error while adding JSON.NET component into my Xamarin iOS app.

The error message is:

<blockquote>

error adding to project: cannot add the libraries to incompatible component

</blockquote>

How to solve this?

Answer1:

Since Xamarin doesn't support the full .NET framework, there is a slimmed down version of JSON.NET that is a specific PCL (<a href="http://msdn.microsoft.com/en-us/library/vstudio/gg597391%28v=vs.100%29.aspx" rel="nofollow">Portable Class Library</a>, also <a href="http://developer.xamarin.com/guides/cross-platform/application_fundamentals/pcl/introduction_to_portable_class_libraries/" rel="nofollow">here on the Xamarin site</a>) written for Xamarin.

See <a href="https://components.xamarin.com/view/json.net/" rel="nofollow">the Xamarin components site</a> for the JSON.NET version for Xamarin.

Answer2:

I suspect the reason you are getting the "cannot add the libraries to incompatible component" is because you have an old version of Xamarin Studio installed.

The latest Json.NET component from Xamarin's Component Store is a shell component and only installs the Json.NET NuGet package. If you have an old version of Xamarin Studio you will not be able to install Json.NET from the Component store. You need at least Xamarin Studio 5.5 to install Json.NET from the Component store.

Another alternative is to install the Json.NET NuGet package instead of the component from the Component store. You can do that by selecting your project, right clicking and selecting Add - Add Packages.

Recommend

  • Azure Mobile Services with Existing Database (without Schema changes)
  • How to solve error C2719 in visual studio 2010 c++ when no code line exist in code
  • MvvmCross for WPF and Xamarin.Mac: is it possible?
  • How can I include multiple models in one view for in a Joomla 3.x component built with Component Cre
  • How to eliminate warning for passing multidimensional array as const multidimensional array?
  • Query pkg-config variable through autotools
  • Alamofire and Reachability.swift not working on xCode8-beta5
  • How can we prepend rows to a react native list-view?
  • how does System.Web.HttpRequest::PathInfo work?
  • Scala multiline string placeholder
  • Does Mobilefirst provide a provision to access web services directly?
  • C: Incompatible pointer type initializing
  • Hardware Accelerated Image Scaling in windows using C++
  • How do I open a C file with a relative path?
  • print() is showing quotation marks in results
  • Make VS2015 use angular-cli ng at build time in a .NET project
  • Android fill_parent issue
  • Exchange data b/w iOS devices using Bluetooth 4.0
  • Insert into database using onclick function
  • Can I display google adwords (AdView) in javafx on android
  • Align navbar back button on right side
  • Get object from AWS S3 as a stream
  • Sony Xperia Z Tablet not found by adb
  • How to add date and time under each post in guestbook in google app engine
  • How to set/get protobuf's extension field in Go?
  • DirectX11 ClearRenderTargetViewback with transparent buffer?
  • Validaiting emails with Net.Mail MailAddress
  • Can I make an Android app that runs a web view in Chrome 39?
  • sending/ receiving email in Java
  • Timeout for blocking function call, i.e., how to stop waiting for user input after X seconds?
  • ORA-29908: missing primary invocation for ancillary operator
  • Web-crawler for facebook in python
  • Function pointer “assignment from incompatible pointer type” only when using vararg ellipsis
  • Akka Routing: Reply's send to router ends up as dead letters
  • Cannot Parse HTML Data Using Android / JSOUP
  • How to include full .NET prerequisite for Wix Burn installer
  • Java static initializers and reflection
  • unknown Exception android
  • Observable and ngFor in Angular 2
  • Unable to use reactive element in my shiny app