Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xamarin Google API client does not exist?

I'm new to Xamarin unfortunately. I've been trying to create a simple page with a map on it using the Xamarin.Forms.Maps package, but upon building I run into about 92 errors all describing that various packages could not be found:

error: package com.google.android.gms.common.api.GoogleApiClient does not exist
error: package com.google.android.gms.common does not exist
error: package com.google.android.gms.maps.GoogleMap does not exist
error: package com.google.android.gms.maps does not exist
error: package com.google.android.gms.tasks does not exist

...and many others. My solution is a Cross-Platform Xamarin.Forms blank mobile app using a .NET class library which I have nothing but the NETStandard.Library, Xamarin.Forms and Xamarin.Forms.Maps packages installed on. I thought that I had set it up correctly according to the official Microsoft documentation, but I still get all these weird errors and searching online for a solution has not been much help. Can someone give me assistance? Let me know if I need to clarify anything.

like image 694
Disruptis Avatar asked Jun 06 '18 21:06

Disruptis


2 Answers

I had exactly the same issue with the same 92 errors after upgrading my version of Xamarin.Forms to V3.0.0.561731 and installing the latest version of Xamarin.Forms.Maps in Visual Studio Community 2017.

I solved the issue by adding "Google Play Services" via the Android SDK Manager. The item can be found on the "Tools" tab of the Android SDK listed under "Extras".

Note: I had to come out of Visual Studio, and rebuild my solution, and it worked.

like image 95
Mena M Avatar answered Sep 22 '22 12:09

Mena M


Make sure you have installed the nuget on your android project Xamarin.GooglePlayServices.Base and Xamarin.GooglePlayServices.Maps

It's a google maps API requisite. You can see an entire explanation on official documentation on this link: https://docs.microsoft.com/en-us/xamarin/android/platform/maps-and-location/maps/maps-api#google-maps-api-prerequisites

like image 21
3 revs Avatar answered Sep 23 '22 12:09

3 revs