微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android – 使用NuGet安装GooglePlayServices会给我一个安装包错误

所以我试图将这个 package安装到我的解决方案中,我遇到了一个奇怪的错误,我似乎无法修复或找到解决方案.

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

我已经尝试将我的目标MonoAndroid版本更改为最新或最早版本,它似乎没有改变任何东西,所以我把它放回原来的位置.

这是我得到的错误.问题是我要么让这个工作(因为Xamarin没有更新他们的网站所以我不能从那里下载它只是拿他们的.dll)或者自己做Google Play服务的绑定,这可能是一个屁股疼.

除非有另一种方式?
提前致谢!

解决方法

查看Xamarin.Android.Support.v7.AppCompat 21.0.3.0 NuGet包它只包含MonoAndroid 4.0.3的程序集,因此您的项目需要在安装之前定位该版本或更高版本.

看起来您正在使用Visual Studio,因此您可以进入项目选项并更改项目属性中的目标Android版本,并使用Android版本更改编译或编辑项目文件(.csproj)并直接更改TargetFrameworkVersion文件.

<TargetFrameworkVersion>v4.3</TargetFrameworkVersion>

如果您需要定位Android 2.2,那么您可以使用Xamarin.GooglePlayServicesFroyo NuGet包,因为它可以安装到针对MonoAndroid 2.2的项目中

原文地址:https://www.jb51.cc/android/310055.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐