xamarin - 反序列化 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"
}
解决方案
因此,我右键单击 Visual Studio 中的文件,然后选择“十六进制编辑器”。瞧,theï
是文件的第一个字符以及>>
左?
大括号之前:{
所以我删除了多余的字符,直到左大括号,错误得到解决。现在到其他错误...
推荐阅读
- c# - 如何在 WebAPI .NET 中使用 XML 作为数据源
- macos - 找不到 Ionic 命令,但 Ionic 安装成功
- r - 为什么我的小型 R 函数占用了大量磁盘空间?
- python-3.x - 计算来自数据框熊猫的纬度经度数据的距离
- reactjs - React 组件类型差异和可分配性
- c# - 构造函数中的异常:Rhino.Mocks.Exceptions.ExpectationViolationException:预期 #0,实际 #1
- sql - SQL Server - 使用参数的 OPENROWSET 服务器名称错误
- javascript - Firestore 总是进行 3 次 api 调用,其中一次需要 60 秒
- c# - 为什么我的窗口上的所有文字都是空白的?
- powerbi - 日期度量以过滤表现出不一致行为的值