Cannot authorize Xamarin to access Google Play account

Hi,
I have an app published to the Play Store. Yesterday my laptop crashed and I had to reinstall Windows and Visual Studio. After I set everything up, I tried to publish an updated version of the app to the store. Upon reaching the "Register Google API Access" screen, I fill in the Client Id and Client Secret fields, then I hit Register. A Google authorization page loads in the browser, I give the required authorization and then I get back the standard success message ("Received verification code. You may now close this window"). However, after switching back to Visual Studio, I see this:

Looking at the Xamarin logs, I found this exception:

System.TypeInitializationException: The type initializer for 'Google.Apis.Json.NewtonsoftJsonSerializer' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified. at Google.Apis.Json.NewtonsoftJsonSerializer..ctor() at Google.Apis.Json.NewtonsoftJsonSerializer..cctor() --- End of inner exception stack trace --- at Google.Apis.Json.NewtonsoftJsonSerializer.get_Instance() at Google.Apis.Auth.OAuth2.Requests.TokenRequestExtenstions.<ExecuteAsync>d__0.MoveNext()

So it seems like Xamarin is trying to use version 10.0.0.0 of Json.NET, which cannot be located. I have no idea about how to solve this. Where is the Json.NET dll that Xamarin is using located? Please help as I need to get this app update out ASAP.

Thanks in advance

Posts

  • GuiF007GuiF007 USMember

    Exactly same problem right now....

  • stesvisstesvis USMember ✭✭✭

    Me too

    Does anybody have an idea?
    Everything was fine till last release and I only changed one line (and updated the packages)

  • AtoxAtox ITMember

    me too.. :(((

  • cjacquelcjacquel FRMember ✭✭✭

    Same problem, Please the Xamarin team it's urgent.

  • cjacquelcjacquel FRMember ✭✭✭

    Is it possible to publish with another method ? At hand ? But I have the message Apk not aligned

  • SpyrosBoutsisSpyrosBoutsis USMember ✭✭

    I can publish successfully by selecting "ad-hoc" in the distribution method screen, getting an APK and uploading manually to the Play Store. Apparently only the store integration is broken, which, of course, is enough to kill productivity...

  • LuisRodriguez92LuisRodriguez92 USMember ✭✭✭

    Same problem

  • LuisRodriguez92LuisRodriguez92 USMember ✭✭✭

    I could upload the application manually, first I opened the folder of the Archive Manager, then align the application (signed), and the went up manually to the store (google play console)

  • KrisAertsKrisAerts USMember

    I'm having the problem.

  • cjacquelcjacquel FRMember ✭✭✭

    Hello Luis,
    Which target version have you chose for Android to create the Apk for the Google store?
    Thx
    cjacquel

  • LuisRodriguez92LuisRodriguez92 USMember ✭✭✭

    @cjacquel said:
    Hello Luis,
    Which target version have you chose for Android to create the Apk for the Google store?
    Thx
    cjacquel

    Android 5.1

  • I have this too, just amazing. This stuff is so brittle. From the log.

    System.TypeInitializationException: The type initializer for 'Google.Apis.Json.NewtonsoftJsonSerializer' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.
    at Google.Apis.Json.NewtonsoftJsonSerializer..ctor()
    at Google.Apis.Json.NewtonsoftJsonSerializer..cctor()
    --- End of inner exception stack trace ---
    at Google.Apis.Json.NewtonsoftJsonSerializer.get_Instance()
    at Google.Apis.Auth.OAuth2.Requests.TokenRequestExtenstions.d__0.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Google.Apis.Auth.OAuth2.Flows.AuthorizationCodeFlow.d__35.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Google.Apis.Auth.OAuth2.Flows.AuthorizationCodeFlow.d__30.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Google.Apis.Auth.OAuth2.AuthorizationCodeInstalledApp.d__8.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Google.Apis.Auth.OAuth2.GoogleWebAuthorizationBroker.d__4.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Google.Apis.Auth.OAuth2.GoogleWebAuthorizationBroker.d__1.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Xamarin.Ide.Google.GooglePlayStore.d__5.MoveNext() in C:\d\lanes\5156\70936af1\source\xamarinvs\src\Core\Xamarin.VisualStudio.Google\GooglePlayStore.cs:line 53

  • Have you found a solution to this problem? I need to upload to google and I cannot. Is there an alternative for this?

  • SpyrosBoutsisSpyrosBoutsis USMember ✭✭

    @JohnPatrikiadis said:
    Have you found a solution to this problem? I need to upload to google and I cannot. Is there an alternative for this?

    Yes, just do an ad-hoc distribution instead of Google Play distribution. Then upload the produced APK manually to the Play Store.

  • JonDouglasJonDouglas USXamarin Team, University, Developer Group Leader Xamurai

    Thank you all for the report on this issue. In the future, you can report this issue via the Report an Issue interface in Visual Studio:

    https://msdn.microsoft.com/en-us/library/mt632287.aspx

    https://docs.microsoft.com/en-us/visualstudio/ide/how-to-report-a-problem-with-visual-studio-2017

    As for a workaround until we can confirm and isolate this issue, you should be able to make an ad-hoc .APK and upload that to Google Play.

    https://developer.xamarin.com/guides/android/deployment,testing,_and_metrics/publishing_an_application/part_3-_publishing_an_application_on_google_play/manually-uploading-the-apk/

    Can anyone please provide reproduction steps and also confirmation if this is only present on Visual Studio 2015? Please also include your Version Information by going to Help -> About Visual Studio -> Copy Info

  • SpyrosBoutsisSpyrosBoutsis USMember ✭✭

    @JonDouglas said:
    Can anyone please provide reproduction steps and also confirmation if this is only present on Visual Studio 2015? Please also include your Version Information by going to Help -> About Visual Studio -> Copy Info

    Hi Jon, no, I'm experiencing this on Visual Studio 2017. Here's my detailed version info:

    Microsoft Visual Studio Community 2017 
    Version 15.4.3
    VisualStudio.15.Release/15.4.3+27004.2008
    Microsoft .NET Framework
    Version 4.7.02556
    
    Installed Version: Community
    
    Visual Basic 2017   00369-60000-00001-AA354
    Microsoft Visual Basic 2017
    
    Visual C# 2017   00369-60000-00001-AA354
    Microsoft Visual C# 2017
    
    Application Insights Tools for Visual Studio Package   8.9.00809.2
    Application Insights Tools for Visual Studio
    
    ASP.NET and Web Tools 2017   15.0.30925.0
    ASP.NET and Web Tools 2017
    
    ASP.NET Core Razor Language Services   1.0
    Provides languages services for ASP.NET Core Razor.
    
    ASP.NET Web Frameworks and Tools 2012   4.0.20601.0
    For additional information, visit https://www.asp.net/
    
    ASP.NET Web Frameworks and Tools 2017   5.2.50921.0
    For additional information, visit https://www.asp.net/
    
    Azure App Service Tools v3.0.0   15.0.30915.0
    Azure App Service Tools v3.0.0
    
    Common Azure Tools   1.10
    Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
    
    JavaScript Language Service   2.0
    JavaScript Language Service
    
    Merq   1.1.17-rc (cba4571)
    Command Bus, Event Stream and Async Manager for Visual Studio extensions.
    
    Microsoft Azure Tools   2.9
    Microsoft Azure Tools for Microsoft Visual Studio 2017 - v2.9.50719.1
    
    Microsoft Continuous Delivery Tools for Visual Studio   0.3
    Simplifying the configuration of continuous build integration and continuous build delivery from within the Visual Studio IDE.
    
    Microsoft JVM Debugger   1.0
    Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
    
    Microsoft MI-Based Debugger   1.0
    Provides support for connecting Visual Studio to MI compatible debuggers
    
    Mono Debugging for Visual Studio   4.7.4-pre (c2d89eb)
    Support for debugging Mono processes with Visual Studio.
    
    NuGet Package Manager   4.4.0
    NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.
    
    SQL Server Data Tools   15.1.61707.200
    Microsoft SQL Server Data Tools
    
    TypeScript   2.3.5.0
    TypeScript tools for Visual Studio
    
    Visual Studio Code Debug Adapter Host Package   1.0
    Interop layer for hosting Visual Studio Code debug adapters in Visual Studio
    
    VisualStudio.IoT   1.0
    Package with IoT components for Visual Studio
    
    VisualStudio.Mac   1.0
    Mac Extension for Visual Studio
    
    Xamarin   4.7.10.38 (34c1b6c)
    Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
    
    Xamarin.Android SDK   8.0.2.1 (HEAD/c2a33d8ea)
    Xamarin.Android Reference Assemblies and MSBuild support.
    
    Xamarin.iOS and Xamarin.Mac SDK   11.3.0.47 (51128b8)
    Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
    
  • JonDouglasJonDouglas USXamarin Team, University, Developer Group Leader Xamurai

    @SpyrosBoutsis Thank you for the confirmation. I will be looking into a proper reproduction to see what's going on.

  • JonDouglasJonDouglas USXamarin Team, University, Developer Group Leader Xamurai

    @SpyrosBoutsis

    I have attempted to reproduce this using the same build as yourself and am unable to do so. After the consent screen, the account is properly added to the store. I will be getting more eyes on this issue momentarily.

  • JaySaccoJaySacco USMember ✭✭
    edited November 2017

    I just hit this problem using VS 2015 after updating to the following versions. I worked around it by doing the ad-hoc build and upload mentioned above.

    Xamarin 4.7.10.38 (34c1b6c)
    Xamarin Android 8.0.2.1 (c2a33d8)
    Xamarin iOS 11.3.0.47 (51128b8)
    Java JDK 1.8.0_152 (64bit)
    android-ndk-r15c (32bit)

  • SopheakUkSopheakUk USMember

    me too. please help asap

  • I have the same problem :(

  • Same problem here...

  • EliotGEliotG USMember ✭✭
    edited December 2017

    I have the exact same problem(same stack trace as StevenWhite.9167) and I'll paste my version info below (along with more complete log info). But I was able to workaround the problem by installing Newtonsoft.Json into the GAC using the following command:

    "c:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\x64\gacutil.exe" /i "C:\Users\Eliot\OneDrive\src\GitHub\SarTag\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll"

    Note that other fixes, like rebooting, rebuilding, manual cleaning, and using nuget to reinstall Newtonson.Json didn't work. Upgrading to the latest Xamarin (.756) broke what .754 fixed and more. Seems like the Xamarin team needs better quality controls.

    Here's my version info:
    Microsoft Visual Studio Professional 2015
    Version 14.0.25431.01 Update 3
    Microsoft .NET Framework
    Version 4.7.02046

    Installed Version: Professional
    
    Visual Basic 2015   00322-50450-03359-AA152
    Microsoft Visual Basic 2015
    
    Visual C# 2015   00322-50450-03359-AA152
    Microsoft Visual C# 2015
    
    Visual C++ 2015   00322-50450-03359-AA152
    Microsoft Visual C++ 2015
    
    Visual F# 2015   00322-50450-03359-AA152
    Microsoft Visual F# 2015
    
    Windows Phone SDK 8.0 - ENU   00322-50450-03359-AA152
    Windows Phone SDK 8.0 - ENU
    
    Application Insights Tools for Visual Studio Package   7.18.00214.2
    Application Insights Tools for Visual Studio
    
    ASP.NET and Web Tools 2015.1 (Beta8)   14.1.11107.0
    ASP.NET and Web Tools 2015.1 (Beta8)
    
    ASP.NET Web Frameworks and Tools 2012.2   4.1.41102.0
    For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563
    
    ASP.NET Web Frameworks and Tools 2013   5.2.40314.0
    For additional information, visit http://www.asp.net/
    
    Common Azure Tools   1.8
    Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
    
    GitHub Extension   0.5
    Allows you to work with GitHub repositories and issues from within Visual Studio
    
    JavaScript Language Service   2.0
    JavaScript Language Service
    
    JavaScript Project System   2.0
    JavaScript Project System
    
    Merq   1.1.17-rc (cba4571)
    Command Bus, Event Stream and Async Manager for Visual Studio extensions.
    
    Microsoft Azure Mobile Services Tools   1.4
    Microsoft Azure Mobile Services Tools
    
    Mono Debugging for Visual Studio   4.8.4-pre (3fe64e3)
    Support for debugging Mono processes with Visual Studio.
    
    NuGet Package Manager   3.4.4
    NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.
    
    PreEmptive Analytics Visualizer   1.2
    Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.
    
    Python Tools for Visual Studio   2.2.40623.00
    Python Tools for Visual Studio provides IntelliSense, projects, templates, Interactive windows, and other support for Python developers.
    
    Python Tools for Visual Studio - Django Integration   2.2.40623.00
    Provides templates and integration for the Django web framework.
    
    Python Tools for Visual Studio - Profiling Support   2.2.40623.00
    Profiling support for Python projects.
    
    SQL Server Data Tools   14.0.60519.0
    Microsoft SQL Server Data Tools
    
    Text Macros for Visual Studio 2012-2017   1.10
    Brings back text-editing macro support in Visual Studio 2012-2017
    
    TypeScript   1.8.36.0
    TypeScript tools for Visual Studio
    
    Visual Studio Tools for Universal Windows Apps   14.0.25420.01
    The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.
    
    VisualStudio.Mac   1.0
    Mac Extension for Visual Studio
    
    Xamarin   4.8.0.756 (64d469412)
    Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
    
    Xamarin Designer   4.8.188 (c5813fa34)
    Visual Studio extension to enable Xamarin Designer tools in Visual Studio.
    
    Xamarin.Android   8.1.0.13 (f241f51)
    Visual Studio extension to enable development for Xamarin.Android.
    
    Xamarin.Android SDK   8.1.0.23 (HEAD/f65f87747)
    Xamarin.Android Reference Assemblies and MSBuild support.
    
    Xamarin.iOS   11.6.1.2 (6857dfc)
    Visual Studio extension to enable development for Xamarin.iOS.
    
    Xamarin.iOS and Xamarin.Mac SDK   11.6.1.2 (6857dfc)
    Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
    

    IDE log:
    Xamarin.VisualStudio.Progress.ProgressReportService|Information|0|Begining distribution, 12/27/2017 12:36:12 AM Xamarin.VisualStudio.Progress.ProgressReportService|Information|0|Channel: Google Play Xamarin.VisualStudio.Progress.ProgressReportService|Information|0|App Bundle Id: com.vectorflight.airflare, Version: 1.0.171218 Xamarin.VisualStudio.Progress.ProgressReportService|Information|0|Publishing to GooglePlay... Xamarin.VisualStudio.Progress.ProgressReportService|Information|0|Signing packages... Xamarin.VisualStudio.Progress.ProgressReportService|Information|0|Skipping signing, using existing signature Xamarin.VisualStudio.Progress.ProgressReportService|Information|0|Preparing to upload apk(s) Xamarin.VisualStudio.Progress.ProgressReportService|Information|0|Authorising... Xamarin.VisualStudio.Progress.ProgressReportService|Information|0|Publishing project 'AirFlare' completed with errors. Xamarin.VisualStudio.Publishing.DistributionManager|Error|0|Google Play Store: Authorize System.TypeInitializationException: The type initializer for 'Google.Apis.Json.NewtonsoftJsonSerializer' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified. at Google.Apis.Json.NewtonsoftJsonSerializer..ctor() at Google.Apis.Json.NewtonsoftJsonSerializer..cctor() --- End of inner exception stack trace --- at Google.Apis.Json.NewtonsoftJsonSerializer.get_Instance() at Google.Apis.Util.Store.FileDataStore.GetAsync[T](String key) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Google.Apis.Auth.OAuth2.Flows.AuthorizationCodeFlow.<LoadTokenAsync>d__27.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Google.Apis.Auth.OAuth2.AuthorizationCodeInstalledApp.<AuthorizeAsync>d__8.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Google.Apis.Auth.OAuth2.GoogleWebAuthorizationBroker.<AuthorizeAsync>d__4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Google.Apis.Auth.OAuth2.GoogleWebAuthorizationBroker.<AuthorizeAsync>d__1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Xamarin.Ide.Google.GooglePlayStore.<GoogleAuthorizeAsync>d__5.MoveNext() in C:\d\lanes\5409\2a34af5f\source\xamarinvs\src\Core\Xamarin.VisualStudio.Google\GooglePlayStore.cs:line 51 Xamarin.VisualStudio.Progress.ProgressReportService|Information|0|Google Play Store: Authorize

  • nvbnvbnvbnvb DEMember ✭✭
    edited January 15

    Same here with VS Community 2015

    After adding ID and secret and clicking "Register" browser says "Received verification code. You may now close this window."
    However VS says that JsonSerializer threw an exception.

    Solution of @EliotG helped

  • SteveGraySteveGray GBMember ✭✭

    Same problem here as well.

  • AgataAgata USMember ✭✭

    Thanks man! It helped :)

    @EliotG said:
    I have the exact same problem(same stack trace as StevenWhite.9167) and I'll paste my version info below (along with more complete log info). But I was able to workaround the problem by installing Newtonsoft.Json into the GAC using the following command:

    "c:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\x64\gacutil.exe" /i "C:\Users\Eliot\OneDrive\src\GitHub\SarTag\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll"

Sign In or Register to comment.