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

«1

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...

  • Luis_dmLuis_dm USMember ✭✭✭

    Same problem

  • Luis_dmLuis_dm 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

  • Luis_dmLuis_dm 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...

  • 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"

  • AugustinBockenAugustinBocken USMember ✭✭

    Could someone explain what is going on with this command ? Thank you.

  • JeanCollasJeanCollas USMember ✭✭

    Same here... VS2017 v15.7.1
    Solved it thanks to @EliotG solution.

  • EliotGEliotG USMember ✭✭

    Interestingly, I had this problem again. I referred back here to how I solved it before, it didn't work, but upgrading from VS 15.7 to 15.7.1 did solve it!

  • HunvHunv USMember ✭✭

    For me after upgrading to 15.7.1 it is broken. Before I didn't had this kind of issue ever.

  • conradheconradhe Member

    Updated from 15.6.7 -> 15.7.2 and also experienced this.

    I used EliotG:s solution, it did not work right away, but after a visual studio restart, it just worked.... Feels sketchy

  • FernandoVMFernandoVM BRMember ✭✭

    @JeanCollas said:
    Same here... VS2017 v15.7.1
    Solved it thanks to @EliotG solution.

    The same for me... :) :)

  • DaveUDaveU GBMember ✭✭
    edited May 28

    The @EliotG solution worked for me too, VS2017 v15.7.1, but bear in mind it has to be v10.0.3 of Newtonsoft so grab the dll from the zip here if you don't have it > https://github.com/JamesNK/Newtonsoft.Json/releases

  • Carl_JuneauCarl_Juneau Member ✭✭

    Hi guys,

    I'm having the same problem. However, I'm a complete Xamarin / Visual Studio newbie, and I'm stuck here in @EliotG's solution:

    [...] 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"

    I've downloaded version 10.0.3 (thanks @DaveU). What's next? I'm stuck and would appreciate all the help.

    Thanks!

  • pauldpauld USMember ✭✭

    @Carl_Juneau said:
    Hi guys,

    I'm having the same problem. However, I'm a complete Xamarin / Visual Studio newbie, and I'm stuck here in @EliotG's solution:

    It's more of a Windows / command-prompt thing...

    You need to get that Newtonsoft.Json.dll into the Windows Global Assembly Cache so that VS can find it. You do that using the gacutil.exe program that's part of the Windows SDK - you may or may not have that installed (programmers seem to end up with it installed to get access to some tool or another...).

    Open a command prompt as Administrator (click Start, type Command and the Command Prompt icon should appear, right-click it and choose Run as Administrator).
    Type gacutil.exe. Does that run something or do you get an error?
    Try running "c:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\x64\gacutil.exe"

    If you get gacutil running, then run it again with the /i option and give it the path to the Newtonsoft.Json.dll (version 10.0.2).
    e.g. gacutil.exe /i downloads\Newtonsoft.json.dll

    If that seems to run ok, exit Visual Studio and run it again. Publishing should work now.

  • Carl_JuneauCarl_Juneau Member ✭✭

    @pauld - it worked! Thank you so much!

    For any other Xamarin newbie here in the same situation, a trick: you cannot paste in the command windows using CTRL + V, but you can using right-click > paste.

    Saves you a lot of hassle trying to type all of that by hand (doh!).

    Thank again Paul!

  • TaliAvrahamTaliAvraham USMember ✭✭

    The workaround didn't work for me I don't have neutonsoft.json.dll version 10.0.2 I used my last version it is 11.0.2 with the gacutil, it successfully added to the cache, but still the same error

  • MarioGagnon.1935MarioGagnon.1935 USMember ✭✭

    I do have 11.0.2 but cannot use gacutil I got
    Microsoft (R) .NET Global Assembly Cache Utility. Version 4.0.30319.0
    Copyright (c) Microsoft Corporation. All rights reserved.

    Failure adding assembly to the cache: Strong name signature could not be verified. Was the assembly built delay-signed?

  • EliotGEliotG USMember ✭✭

    Having this problem a 3rd time. GAC didn't work again... no VS upgrade to kick it in the pants... I was about to use FusLogVw to see exactly which paths it's trying and what's failing.

«1
Sign In or Register to comment.