Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

HELP: Xamarin Google Play Services from NuGet requires non existent Xamarin Forms version !?

AndrewzAndrewz USMember ✭✭
edited February 2017 in Xamarin.Forms

I created a Xamarin Forms XAML Shared app in VS2015.
I updated to latest stable XF 2.3.3.180.

I'm trying to install Xamarin Google Play Services by NuGet but it says it needs to upgrade Xamarin Forms to v2.3.3.193. But there is no such version.

How can I use Google Play Services with Xamarin Forms?
I'm confused...

If I hit OK, then Project Explorer shows yellow icons for some references....

Answers

  • mattwardmattward GBMember Xamurai
    edited February 2017

    Which Xamarin Google Play Services NuGet package did you install? Looking at the list it looks like Xamarin.GooglePlayServices.Location. The Xamarin.Forms 2.3.3.193 NuGet package exists but it has been unlisted for some reason:

    https://www.nuget.org/packages/Xamarin.Forms/2.3.3.193
    

    If I install Xamarin.GooglePlayServices.Location I also see Xamarin.Forms 2.3.3.193 installed.

    I cannot see any GooglePlay or Android NuGet package that depends on Xamarin.Forms. So it looks like NuGet has resolved this as a dependency since Xamarin.Forms 2.3.3.193 supports the later versions of the Xamarin.Android NuGet packages, versions above 23.3.0, whilst Xamarin.Forms 2.3.3.180 only supports 23.3.0.

    It is also interesting that NuGet uses an unlisted NuGet package when resolving dependency. I would guess that it is just looking for the latest stable version, unlisted or not.

  • AndrewzAndrewz USMember ✭✭
    edited February 2017

    @mattward Thank you for reply.
    I'm just trying to install latest Xamarin.GooglePlayServices.Location from NuGet in Visual Studio 2013.

    If I understand correctly, it looks like Xamarin Forms continues to be desync'ed from Xamarin Google Play Services in terms of which Android version is referenced. Which creates the problem I have I think.

    The fact that there is an unlisted Xamarin.Forms 2.3.3.193 it's even more confusing. Until now I didn't even realize that the NuGet package manager in Visual Studio finds & uses unlisted versions on NuGet.... Thank you for making me aware of that.

    So what is the solution?

    I'm just following a normal flow where you create a Xamarin Forms app, then you add other Xamarin libraries, in this case Xamarin Google Play Services. And you don't want the pre-release versions on NuGet unless there's a good reason. Shouldn't this just work?

  • mattwardmattward GBMember Xamurai

    Xamarin.Forms and Xamarin Google Play Services both depend on Xamarin.Android NuGet packages. The older NuGet packages were tied to specific versions of the Xamarin.Android NuGet packages which made it difficult to upgrade other parts. The newer versions have a more relaxed version requirement.

    The only solution, which is more of a workaround, is to use an older Xamarin Google Play Services that supports the same Xamarin.Android NuGet packages as the Xamarin.Forms NuGet package you have installed. Or wait until a new stable release of Xamarin.Forms is pushed to nuget.org.

    Xamarin.Forms 2.3.3.193 is not a pre-release NuGet package it has just been unlisted for some reason. The NuGet behaviour is reasonable if a bit unexpected. If that unlisted package was not there the install would fail since the Xamarin.Forms 2.3.3.180 NuGet package is tied to a specific version of the Xamarin.Android NuGet packages. Only the 2.3.3.193 Xamarin.Forms NuGet package works with later versions of the Xamarin.Android NuGet packages.

  • AndrewzAndrewz USMember ✭✭
    edited February 2017

    It would be much better if somehow NuGet failed to install Google Play Services.
    I'm in a common scenario where I create an app and I don't want to use any unreleased / unlisted packages, I only want stable/released.

    I don't understand why Xamarin Forms team decided to leave Xamarin.Forms 2.3.3.193. It's very confusing having both unreleased and unlisted versions. I don't even undertsand what 2.3.3.193 version is, I searched for exact string on forum and I have found just 2 other threads but discussing something else.

    I know you're NuGet guy, but do you know where can I find information on what has been changed on Xamarin Google Play services?
    So I can decide whether I can use an earlier version.
    The page on component store nor on Nuget does not give any info on what has been changed.

  • DirkWilhelmDirkWilhelm USMember ✭✭✭✭✭

    @Andrewz take a look here for th Release Notes of 2.3.3.193:

    https://github.com/xamarin/Xamarin.Forms/releases/tag/release-2.3.3-sr2

  • mattwardmattward GBMember Xamurai

    There is some information on the NuGet pages. Not an extensive list of changes such as are listed with Xamarin.Forms. Mostly it seems to be which version of the Google Play Services that are supported with that particular NuGet package, at least with the more recent releases.

  • AndrewzAndrewz USMember ✭✭

    I still don't understand why even with Xamarin Forms 2.3.3.193, Visual Studio shows yellow icons and warnings:

  • AndrewzAndrewz USMember ✭✭

    Even the previous version of Xamarin Google Play Services Location v32.961.0 also asks for Xamarin Forms 2.3.3.193.
    I'd have to go down to v29.0.0.2 so that Xamarin Forms 2.3.3.193 is not required, but this is too old....

    What do you recommend? I could I guess go with Xamarin Forms 2.3.3.193 but I don't like those warnings...

  • AndrewzAndrewz USMember ✭✭
    edited February 2017

    What is the reason of those warnings anyway? I can't figure out. The reference is there, on the right path.
    Is it maybe because these assemblies try to reference a different version of Android? I'm confused...

  • mattwardmattward GBMember Xamurai
    edited February 2017

    It does not seem to be related to Xamarin.Forms. I can reproduce the warnings on the references in Visual Studio with an Android project by just installing the Xamarin.GooglePlay.Location NuGet package. The project still seems to compile.

    NuGet does have some strange behaviour with that unlisted NuGet package. Xamarin Studio allows you to update to it. Visual Studio will update to it if you use the Package Manager console window, but from the GUI.

  • AndrewzAndrewz USMember ✭✭

    @mattward Aren't those warnings because Xamarin Forms is not compatible with the version of Android Support libraries updated by latest Google Play Services?
    In other words, maybe not even the unlisted Xamarin Forms 2.3.3.193 is compatible with that version of Android Support libraries required by the Google Play Services?

  • mattwardmattward GBMember Xamurai

    I was testing just the Xamarin.Android NuGet packages with the Google Play Services NuGet packages and can reproduce the same problem. So I do not think it is a problem specific to Xamarin.Forms. Just in the process of updating the Xamarin extension in Visual Studio to see if it makes any difference.

  • AndrewzAndrewz USMember ✭✭

    Any news on this?
    Basically I can't use latest stable Xamarin Google Play Services.... I'd have to use a very old(many months back) stable version instead.

    Also, since this issue doesn't actually have to do with Xamarin Forms projects, I'm pretty confused, in which scenario does it actually work?

  • AndrewzAndrewz USMember ✭✭
    edited February 2017

    @JamesMontemagno @DavidOrtinau can you please help on this?

  • DavidOrtinauDavidOrtinau USForum Administrator, Xamarin Team, Insider, University Xamurai

    @Andrewz said:
    @DavidOrtinau can you please help on this?

    Xamarin.Forms 2.3.3.193 and 2.3.4.192-pre2 both should allow you to use any Android API version so long as you're targeting framework 7.0 or greater.

    2.3.3.193 is unlisted so we can stage a stable release for integration with our tools. It seems there some problem in NuGet or XS making it visible to you. I think @mattward is on that. Sorry for the confusion.

    Other users are reporting success using Google Play Services with these Xamarin.Forms versions. I'll confirm the details right now and post back shortly.

  • DavidOrtinauDavidOrtinau USForum Administrator, Xamarin Team, Insider, University Xamurai

    I setup a new project and was able to build successfully with 2.3.4.192-pre2 with the latest Xamarin.GooglePlayServices.Location. Am I misunderstanding something here? I wonder if NuGet is supremely confused on your system.

    This is what I have installed:

    <?xml version="1.0" encoding="utf-8"?>
    <packages>
      <package id="Xamarin.Android.Support.Animated.Vector.Drawable" version="25.1.1" targetFramework="monoandroid70" />
      <package id="Xamarin.Android.Support.Compat" version="25.1.1" targetFramework="monoandroid70" />
      <package id="Xamarin.Android.Support.Core.UI" version="25.1.1" targetFramework="monoandroid70" />
      <package id="Xamarin.Android.Support.Core.Utils" version="25.1.1" targetFramework="monoandroid70" />
      <package id="Xamarin.Android.Support.Design" version="25.1.1" targetFramework="monoandroid70" />
      <package id="Xamarin.Android.Support.Fragment" version="25.1.1" targetFramework="monoandroid70" />
      <package id="Xamarin.Android.Support.Media.Compat" version="25.1.1" targetFramework="monoandroid70" />
      <package id="Xamarin.Android.Support.Transition" version="25.1.1" targetFramework="monoandroid70" />
      <package id="Xamarin.Android.Support.v4" version="25.1.1" targetFramework="monoandroid70" />
      <package id="Xamarin.Android.Support.v7.AppCompat" version="25.1.1" targetFramework="monoandroid70" />
      <package id="Xamarin.Android.Support.v7.CardView" version="25.1.1" targetFramework="monoandroid70" />
      <package id="Xamarin.Android.Support.v7.MediaRouter" version="25.1.1" targetFramework="monoandroid70" />
      <package id="Xamarin.Android.Support.v7.Palette" version="25.1.1" targetFramework="monoandroid70" />
      <package id="Xamarin.Android.Support.v7.RecyclerView" version="25.1.1" targetFramework="monoandroid70" />
      <package id="Xamarin.Android.Support.Vector.Drawable" version="25.1.1" targetFramework="monoandroid70" />
      <package id="Xamarin.Build.Download" version="0.4.2" targetFramework="monoandroid70" />
      <package id="Xamarin.Forms" version="2.3.4.192-pre2" targetFramework="monoandroid70" />
      <package id="Xamarin.GooglePlayServices.Base" version="42.1001.0" targetFramework="monoandroid70" />
      <package id="Xamarin.GooglePlayServices.Basement" version="42.1001.0" targetFramework="monoandroid70" />
      <package id="Xamarin.GooglePlayServices.Location" version="42.1001.0" targetFramework="monoandroid70" />
      <package id="Xamarin.GooglePlayServices.Tasks" version="42.1001.0" targetFramework="monoandroid70" />
    </packages>
    
  • @DavidOrtinau said:
    2.3.3.193 is unlisted so we can stage a stable release for integration with our tools. It seems there some problem in NuGet or XS making it visible to you. I think @mattward is on that. Sorry for the confusion.

    There is no problem with Nuget, everything is worked as intended: https://docs.microsoft.com/en-us/nuget/policies/deleting-packages

    That being said, is there any detriment to using that unlisted package?

  • AndrewzAndrewz USMember ✭✭
    edited February 2017

    @DavidOrtinau You said you built successfully, but you don't have any yellow warnings icons on some of the references in the Android project?

    The warnings are NOT visible right after installing packages. After installing packages NuGet asks you restart Visual Studio. After restarting and reopening the project, I could see several warnings that some of the references could not be loaded, even if they are obviously there on disk and paths are right.

    As discussed above, this has nothing to do with Xamarin Forms, @mattward also reproduced this on an Xamarin Android project without Xamarin Forms.

  • mattwardmattward GBMember Xamurai

    @Andrewz - The problem seems to have something to do with the imported .targets files that the various Xamarin.Android NuGet packages adds. If you comment out the Xamarin.Build.targets import at the end of the project the warnings in Visual Studio 2015 disappear. Similarly if you leave the Xamarin.Build import uncommented and then comment out the imported .targets added by the Xamarin.Android NuGet packages then the warnings disappear. The build still works. It is not obvious what Visual Studio 2015 does not like about the .targets files.

  • AndrewzAndrewz USMember ✭✭

    Thank you @mattward
    Two things:
    1. Is this a known issue for Xamarin, something which is currently under investigation/fixing?
    2. It's not clear to me whether it's safe to ignore all those warnings or not? If it's not safe, should I comment the Xamarin.Build.targets import as you suggested?

  • mattwardmattward GBMember Xamurai

    @Andrewz - I have reported it to the owners of the Xamarin.Android NuGet packages. They are currently investigating.

    If your project builds without the Xamarin.Build.targets added then it should be OK. Looking at that NuGet package it is used to download the various Android .zips into %LocalAppData%\XamarinBuildDownloadCache which are needed at build time.

  • AndrewzAndrewz USMember ✭✭

    This issue persists on the latest released Xamarin version....

  • FlorianDayanFlorianDayan USMember ✭✭

    @Andrewz I'm facing exactly the same issue with the yellow warnings appearing after restarting VS, is there something new about it ?

  • FlorianDayanFlorianDayan USMember ✭✭

    @Andrewz @mattward I was able to fix the issue thanks to this comment : https://forums.xamarin.com/discussion/comment/261922/#Comment_261922

    You just have to update Xamarin.Build.Download from 0.4.2 to 0.4.3 (last version released on March 27)

Sign In or Register to comment.