Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 443
lcote Avatar asked Feb 13 '15 16:02

lcote


3 Answers

The following settings work for me:

enter image description here

like image 61
Sergey Metlov Avatar answered Oct 20 '22 20:10

Sergey Metlov


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

like image 4
Matt Ward Avatar answered Oct 20 '22 20:10

Matt Ward


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

to this:

enter image description here

like image 2
IdoT Avatar answered Oct 20 '22 22:10

IdoT