lcote
lcote

Reputation: 101

Installing GooglePlayServices with NuGet gives me a Install-Package error

So I'm trying to install this package into my solution and I'm having a weird error I can't seem to fix or find a solution for.

Install failed. Rolling back... Install-Package : Could not install package 'Xamarin.Android.Support.v7.AppCompat 21.0.3.0'. You are trying to install this package into a project that targets 'MonoAndroid,Version=v2.2', but the pack age does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author. At line:1 char:16 + Install-Package <<<< Xamarin.GooglePlayServices + CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

I've tried changing my target MonoAndroid version to either the latest or the earliest and it didn't seem to change anything, so I've put it back to where it was originally.

This is the error I'm getting. The problem is I either need to get this to work (because Xamarin didn't update their website so I can't download it from there and just take their .dll) OR do the bindings for Google Play Services myself which would probably be a pain in the ass.

Unless there is another way? Thanks in advance!

Upvotes: 6

Views: 3012

Answers (3)

IdoT
IdoT

Reputation: 2871

Following this answer, all you have to do is change this:enter image description here

to this:

enter image description here

Upvotes: 2

Sergey Metlov
Sergey Metlov

Reputation: 26291

The following settings work for me:

enter image description here

Upvotes: 5

Matt Ward
Matt Ward

Reputation: 47917

Looking at the Xamarin.Android.Support.v7.AppCompat 21.0.3.0 NuGet package it only contains an assembly for MonoAndroid 4.0.3 so your project will need to target that version or above before you can install it.

It looks like you are using Visual Studio so you can either go into the project options and change the targeted Android version in the project properties and change the Compile using Android version or edit the project file (.csproj) and change the TargetFrameworkVersion directly in the file.

<TargetFrameworkVersion>v4.3</TargetFrameworkVersion>

If you need to target Android 2.2 then you could use the Xamarin.GooglePlayServicesFroyo NuGet package since that can be installed into a project that targets MonoAndroid 2.2

Upvotes: 4

Related Questions