The type or namespace name 'Gms' does not exist in the namespace 'Android'

DavidHMDavidHM USMember ✭✭

"(are you missing an assembly reference?)"

I'm a long time Java/Android developer trying now to get a mapping app working in Xamarin. I found the following post which seems to be on point, but didn't help me:

https://forums.xamarin.com/discussion/6777/google-map-v2-didnt-find-class-com-google-android-gms-maps-mapfragment

I have the "Google Play Services" SDK installed. I have added a component "Google Play Services - Maps", yet i cannot compile my Map activity because of the following:

**
using Android.Gms.Maps;
using Android.Gms.Maps.Model;
**
looking at the samples i see under "References": Xamarin.GooglePlayServices.Base, Xamarin.GooglePlayServices.Basement, Xamarin.GooglePlayServices.Maps. How did they get there??? since i have a component (which the sample does NOT have...do i need these References?

help!!!!

Tagged:

Best Answer

Answers

  • gtlealgtleal BRMember ✭✭

    Hi. Check this link:
    https://blog.xamarin.com/new-improved-google-play-services-for-android/

    You can get them throught: References > Manage NuGet Packages

    p.PNG 30.8K
  • DavidHMDavidHM USMember ✭✭

    Turns out, through luck, i already have them. When i right click on "References" and i select "Manage NuGet Packages" i see "Xamarin.GooglePlayServices.Base" and "...Basement" and "...Maps" and "Xamarin.Android.Support.v4". However they do NOT show up in the list of references (like the samples show). what's the magic to get them on the list of References?

  • gtlealgtleal BRMember ✭✭

    Inside packages.config file delete the lines from these libraries, then, go to the NuGet and try again.

  • DavidHMDavidHM USMember ✭✭

    trying to add Base, Basement, Maps, and Support v4. from "References" i right-click and choose "Manage NuGet Packages". i locate the "Base" and try to Install it. there are some dependencies (about 8 or 9). i hit "OK" and get:

    Error Could not install package 'Xamarin.Android.Support.Compat 24.2.1'. You are trying to install this package into a project that targets 'MonoAndroid,Version=v6.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

    i have no idea what this means. i'm compiling with Marshmellow (v6), but am not sure that's the v6.0 the error msg is referring to.

    David

  • DavidHMDavidHM USMember ✭✭

    I just created a new Project...did nothing other than try to add reference to Xamarin.GooglePlayServices.Maps...and i get the same "v6.0" error message! out-of-the-box! Clearly there's something i'm missing.

  • DavidHMDavidHM USMember ✭✭

    that forum post is exactly what i am experiencing, however when i try and get the latest Xamarin "Other", it tells me:

    "Xamarin for Visual Studio is up to date"

    and nothing else happens. drat!

  • gtlealgtleal BRMember ✭✭

    The Xamarin.Android.Support.Compat 24.2.1 NuGet package contains assemblies for MonoAndroid v7.0. So you will need to change the target framework of your Android project to be 7.0. You should be able to change that in the Visual Studio project options.

    You may need to update your Android SDKs if v7.0 is not available.

    Check this: https://forums.xamarin.com/discussion/81123/why-are-all-components-incomplete

  • DavidHMDavidHM USMember ✭✭

    i have targeted v6.0 (Marshmallow) and v7.0 (Nougat) with the same result:

    Error Could not install package 'Xamarin.Android.Support.Compat 24.2.1'. You are trying to install this package into a project that targets 'MonoAndroid,Version=v6.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

    here's what i'm doing: from the Solutions Explorer i select my solution. i right-click and choose "Properties". I set the Target Android Version to v6.0 (Mashmallow) or v7.0 (Nougat) and then close that window. In the Solutions Explorer i select "References". i right-click and select "Manage NuGet Packages". searching for "Google Play Services" i pick "...Base" and click "Install".

  • DavidHMDavidHM USMember ✭✭

    "You should be able to change that in the Visual Studio project options." Where? i've looked and looked and haven't (yet?) found that setting. Where exactly in Visual Studio 2015 should i look?

    thanks in advance!

  • DavidHMDavidHM USMember ✭✭

    i got it!!! I had to install Nougat (v7.0) (note: i had v7.1.1). Then under Project Properties i could finally select "Nougat v7.0" for the Target API and build levels.

    after that, going to "References" - "Manage NuGet Packages" i was able to add the Google Play Services - Map!

    Thanks for the help!!!!!

  • DavidHMDavidHM USMember ✭✭

    on 2nd thought: i don't have a v7.0 device, so i cannot run it my v6.0.1 tablet. Now i need to add Google Play Services for v6.0. how? i only know of the v7.0 Google Play Services (NuGet Packages). where do i get the v6.0 versions?

  • ShimmyWeitzhandlerShimmyWeitzhandler USMember ✭✭✭

    @gtleal
    The Xamarin.GooglePlayServices version are currently 29.0.0.1.
    What version should I lower it to? Will this screw up other things, because Maps is not the only thing around here.
    The issue I'm facing is here:

  • ankhelborankhelbor Member ✭✭

    The problem is probably that you are mixing versions of Play Services components.

    4.4.0 is built against an older version, compared to what is in stable currently, so it needs a new build and release.

  • ankhelborankhelbor Member ✭✭

    @ankhelbor said:
    The problem is probably that you are mixing versions of Play Services components.

    4.4.0 is built against an older version, compared to what is in stable currently, so it needs a new build and release.

    Plex Lucky Patcher Kodi

  • vinothswamivinothswami Member ✭✭

    I too have the same problem

    the visual studio used - 2015
    target framework - 7.0
    install Nuget Google play map service tried to install 29.0.0.1/32.x.x.x/40.x.x.x/ 60.1142.0 nothing works

    2 days to fix this issue...

    Many things I checked as follows.

    1. Check the VS Android SDK manager whether targeted SDK is installed or not
    2. open -> Android SDK manager in VS -> go to extras -> install Google play services
    3. go to tools in VS -> options -> xamarin -> other -> click now for check for updates and restart the system not VS only.
    4. build your projects if google map again showing error, just select the google obj and press show potential fixes then take the last option as Using Android.gms.map which is already mentioned in the code.

    I hope this will fix because it's worked for me.

Sign In or Register to comment.