enstam
enstam

Reputation: 23

How can I add libraries to Xamarin Mono for Android project in VS2010?

I am working on a mono for Android application (my very first) that consumes a web api. In the documentation at xamarin.com there are examples on using different libraries such as RestSharp and Json.Net.

However, when I try to install these libraries via Nuget in my VS2010 project it failes with the following message:

Install failed. Rolling back... Could not install package 'Newtonsoft.Json 4.5.9'. You are trying to install this package into a project that targets 'MonoAndroid,Version=v2.2', but the package does not contain any assembly references that are compatible with that framework. For more information, contact the package author.

How can I include such libraries in my project?

Thanks in advance.

Erwin

Upvotes: 2

Views: 4127

Answers (2)

Teeknow
Teeknow

Reputation: 1015

Not sure if you've tried this but if you're using xamarin studio and right click the component folder in your Android app project choosing add component should be able to solve your problem. This will add a reference to the component that is added. Components seem like they are mono compatible packages and what's good for your case is that there are components for both RestSharp and Json.Net:

https://components.xamarin.com/view/restsharp

http://components.xamarin.com/view/json.net/

Upvotes: 0

Narcís Calvet
Narcís Calvet

Reputation: 7452

This error message indicates those libraries are not compatible with Mono for Android. You should ask the manufacturer of the libraries if they have a MfA compatible version. If you have the source code of the libraries you could also try to make a MfA library, using linked source files, yourself.

Upvotes: 1

Related Questions