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
安装失败。回滚……安装包:不能安装包的Xamarin.Android.Support.v7。AppCompat 21.0.3.0”。您正在尝试将这个包安装到一个目标为“MonoAndroid,Version=v2.2”的项目中,但是包的年龄不包含任何与该框架兼容的程序集引用或内容文件。有关更多信息,请与包作者联系。在line:1 char:16 + Install-Package <<< Xamarin。GooglePlayServices + CategoryInfo:没有指定的:(:)[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.
这是我得到的误差。问题是,我要么需要让它工作(因为Xamarin没有更新他们的网站,所以我不能从那里下载它,只拿他们的。dll),或者为谷歌做绑定,这可能会让你很痛苦。
Unless there is another way? Thanks in advance!
除非有别的办法?提前谢谢!
3 个解决方案
#1
4
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.
看Xamarin.Android.Support.v7。AppCompat 21.0.3.0 NuGet包它只包含一个用于MonoAndroid 4.0.3的程序集,因此您的项目需要在安装它之前将其目标锁定在该版本或上面。
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.
看起来您使用的是Visual Studio,因此您可以进入项目选项,并在项目属性中更改目标Android版本,并使用Android版本更改编译,或者编辑项目文件(.csproj),并在文件中直接更改TargetFrameworkVersion。
<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
如果你需要使用Android 2.2,那么你可以使用Xamarin。GooglePlayServicesFroyo NuGet软件包,因为它可以安装到一个目标为android 2.2的项目中。
#2
5
The following settings work for me:
以下设置为我工作:
#1
4
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.
看Xamarin.Android.Support.v7。AppCompat 21.0.3.0 NuGet包它只包含一个用于MonoAndroid 4.0.3的程序集,因此您的项目需要在安装它之前将其目标锁定在该版本或上面。
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.
看起来您使用的是Visual Studio,因此您可以进入项目选项,并在项目属性中更改目标Android版本,并使用Android版本更改编译,或者编辑项目文件(.csproj),并在文件中直接更改TargetFrameworkVersion。
<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
如果你需要使用Android 2.2,那么你可以使用Xamarin。GooglePlayServicesFroyo NuGet软件包,因为它可以安装到一个目标为android 2.2的项目中。
#2
5
The following settings work for me:
以下设置为我工作: