缺少xamarin.googleplayservices参考

时间:2018-03-06 19:01:34

标签: xamarin xamarin.forms

我正在尝试在我的xamarin表单应用程序上使用谷歌地图。我安装了Google.forms.maps。通过该安装,我得到了以下包裹:

  <package id="Xamarin.GooglePlayServices.Base" version="42.1021.1"    targetFramework="monoandroid71" />
  <package id="Xamarin.GooglePlayServices.Basement" version="42.1021.1" targetFramework="monoandroid71" />
  <package id="Xamarin.GooglePlayServices.Maps" version="42.1021.1" targetFramework="monoandroid71" />
  <package id="Xamarin.GooglePlayServices.Tasks" version="42.1021.1" targetFramework="monoandroid71" />

一旦我开始运行应用程序,这些dll就会从android项目引用中消失,我就会收到错误

Severity    Code    Description Project File    Line    Suppression State
Error       Did not find reference matching RestoreAssemblyResources AssemblyName metadata 'Xamarin.GooglePlayServices.Tasks'   app1.Android

Did not find reference matching RestoreAssemblyResources AssemblyName metadata 'Xamarin.GooglePlayServices.Base'    app1.Android    
Did not find reference matching RestoreAssemblyResources AssemblyName metadata 'Xamarin.GooglePlayServices.Maps'    app1.Android
Did not find reference matching RestoreAssemblyResources AssemblyName metadata 'Xamarin.GooglePlayServices.Basemant'    app1.Android    

我用Google搜索了这个错误并尝试使用nuget单独添加这些包,所以我做了这个

Install-Package Xamarin.GooglePlayServices.Base -Version 60.1142.0 

我说错误

Install-Package : Could not install package 'Xamarin.GooglePlayServices.Base 60.1142.0'. You are trying to install this package into a project that targets 'MonoAndroid,Version=v7.1', but the package does not contain any 

与该框架兼容的程序集引用或内容文件。有关更多信息,请与软件包作者联系。

所以我试着这样做:

Install-Package Xamarin.GooglePlayServices.Base -Version 29.0.0.1 

我得到了与nuget包版本60.1142.0相同的错误

我使用的是Visual Studio 2017企业版。

在这方面的任何帮助将不胜感激。以下是android项目的目标:

enter image description here

enter image description here

我的目标框架是这样的:

enter image description here

和sdk图片是这样的:

enter image description here

以下是visual studio帮助 - &gt;关于窗口。

enter image description here

1 个答案:

答案 0 :(得分:1)

通用消息:

  

无法安装软件包&#39; Xamarin.XXXXXXX&#39;。您正尝试将此软件包安装到以MonoAndroid,Version = vX.X&#39;

为目标的项目中

具体信息:

  

无法安装软件包&#39; Xamarin.GooglePlayServices.Base 60.1142.0&#39;。您正尝试将此软件包安装到以MonoAndroid为目标的项目中,版本= v7.1&#39;

Xamarin.Android项目更改为至少MonoAndroid 8.0,因为Xamarin.GooglePlayServices.Base v60.1142.0依赖于8.0

enter image description here

Nuget:Xamarin.GooglePlayServices.Base/60.1142.0

依赖关系

enter image description here