首页 > 解决方案 > 反序列化 Google-services.json 文件时出错

问题描述

尝试按照说明通过 MS App 中心设置推送通知。所以我按照说明在 Firebase 控制台中创建了一个应用程序,然后从那里下载了 google-services.json 文件。将其复制到我的项目并将构建操作修复为 GoogleServicesJson。在 Firebase、App Center 和我的代码中完成了其余的设置。但是当我尝试构建时,出现以下错误- There was an error deserializing the object of type Xamarin.GooglePlayServices.Tasks.GoogleServices.

堆栈跟踪给了我这个信息:

There was an error deserializing the object of type Xamarin.GooglePlayServices.Tasks.GoogleServices. Encountered an unexpected character 'ï' in JSON. ---> System.Xml.XmlException: Encountered an unexpected character 'ï' in JSON.

但我在文件中的任何地方都没有看到 ï。搜索了这个问题,发现人们使用解析器来解决这个问题,但我不确定在哪里应用所述解析器。有人遇到过这种情况吗?

这是文件的样子

{
  "project_info": {
    .. Configuration info ..
  },
  "client": [
    {
      .. Lots of lines ..
    }
  ],
  "configuration_version": "1"
}

标签: xamarinxamarin.androidvisual-studio-app-center

解决方案


因此,我右键单击 Visual Studio 中的文件,然后选择“十六进制编辑器”。瞧,theï是文件的第一个字符以及>>?大括号之前:{

所以我删除了多余的字符,直到左大括号,错误得到解决。现在到其他错误...


推荐阅读