xamarinxamarin.androidvisual-studio-app-center

Error deserializing Google-services.json file


Tried to follow the instructions to setup Push notification through the MS App center. So I created an app in the Firebase console as per the instructions, and then downloaded the google-services.json file from there. Copied it over to my project and fixed the build action to GoogleServicesJson. Completed the rest of the setup in Firebase, App Center and in my code. But when I tried to build, I got the following error- There was an error deserializing the object of type Xamarin.GooglePlayServices.Tasks.GoogleServices.

The stack trace gave me this information:

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.

but I dont see ï anywhere in the file. Searched the issue and found people using a parser to fix this, but I'm not sure where to apply said parser. Any one face this before?

Here's what the file looks like

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

Solution

  • So, I right clicked on the file in Visual Studio, and Selected "Hex Editor". Lo and behold, the ï was the first character of the file along with >> and ? before the opening brace: {

    So I deleted the extra characters until the opening brace, and the error was resolved. Onto other errors now...