2016-04-22 122 views
5

我無法將GCM添加​​到我的Xamarin應用中。這是來自程序包控制檯的輸出:無法添加Xamarin Google Play服務

Adding Xamarin.GooglePlayServices.Gcm... 
Attempting to resolve dependency 'Xamarin.GooglePlayServices.Base (= 29.0.0.1)'. 
Attempting to resolve dependency 'Xamarin.GooglePlayServices.Basement (= 29.0.0.1)'. 
Attempting to resolve dependency 'Xamarin.Android.Support.v4 (≥ 23.1.1.1)'. 
Attempting to resolve dependency 'Xamarin.GooglePlayServices.Measurement (= 29.0.0.1)'. 
Updating 'Xamarin.Android.Support.v4 23.0.1.3' to 'Xamarin.Android.Support.v4 23.3.0' failed. Unable to find a version of 'Xamarin.Forms' that is compatible with 'Xamarin.Android.Support.v4 23.3.0'. 

回答

0

您需要更新Xamarin.Forms包。在打開包裝解決方案(下拉)窗格,右鍵單擊Xamarin.Forms,點擊更新

enter image description here

如果您正在使用PCL,你可以找到這個包在PCL(Xamarin.Forms)項目。

如果您使用Shared Asset Project,您將在Xamarin.Android和Xamarin.iOS項目中找到該軟件包。

+1

這沒有奏效。必須有一些循環問題阻止軟件包更新正常工作。最後,我不得不移除Xamarin Forms,然後在軟件包上運行更新以獲得更新版本的MediaRouter,然後添加Xamarin Forms。 – MarkB

+0

我刪除了所有包,然後重新添加Xamarin表單。然後嘗試添加GCM。這是我相信Xamarin必須解決的版本衝突。請在此查看日誌: https://www.dropbox.com/s/kifib3u3ortk6zm/package.log – MarkB

3

對於此版本,您必須安裝較早版本的Xamarin.GooglePlayServices.Gcm。我對27.0.0沒有任何問題。

如果你需要最新的版本,你可以這樣做:

  • 卸載xamarin.forms NuGet包
  • 更新所有Android軟件包23.3.0
  • 安裝Xamarin.GooglePlayServices.Gcm
  • 搜索xamarin.forms並設置選項ignore dependencies
  • 安裝最新版本

當然,您必須意識到問題,因爲不建議有充分的理由。

0

您必須將Android SDK Platform-tools更新爲修訂版26.0.2(或同等版本)。

打開Android SDK管理器,檢查更新,並選擇

「更新繳費rev.26.0.2」 並安裝它。

enter image description here

相關問題