Xamarin.Forms 使用 Google 云消息传递的应用程序无法发布

Xamarin.Forms application using Google Cloud Messaging can't publish

使用 Xamarin.Forms + Visual Studio 2015 并添加 Google Cloud Messaging Client 组件,当构建 .Drod 项目时会收到​​一些警告消息并发布到设备和模拟器将失败.

Xamarin.Forms v2.3.2.127 Visual Studio 2015 更新 Xamarin 以获得稳定的最新版本

警告消息:

发现同一依赖程序集的不同版本之间存在冲突。 在Visual Studio中双击此警告(或select并回车)修复冲突;否则,将以下绑定重定向添加到应用程序配置文件中的 "runtime" 节点:......

案例重做步骤:

(1) 创建新的 Xamarin.Forms (PCL)

(2) .Drod 项目添加 Google 云消息客户端组件

(3) 构建项目

我尝试修改 .Droid 项目 app.config ,但仍然失败

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="System.ObjectModel" publicKeyToken="B03F5F7F11D50A3A" culture="neutral"/>
            <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0"/>
        </dependentAssembly>
        <dependentAssembly>
            <assemblyIdentity name="System.Runtime" publicKeyToken="B03F5F7F11D50A3A" culture="neutral"/>
            <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0"/>
        </dependentAssembly>
    </assemblyBinding>

它们只是警告,所以它们不应该是发布失败的根本原因。

以前使用Google云消息(GCM)我运行遇到了类似的问题,这是因为我的应用程序包名称以大写字母开头。

请参阅 xamarin GCM 文档中的以下说明

It is VERY important that your application's package name does NOT start with an uppercase letter. This will cause an error in deploying your application to a simulator or device.

https://components.xamarin.com/gettingstarted/googleplayservices-gcm