Reputation: 109
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.
Upvotes: 9
Views: 4711
Reputation: 429
I've been seeing these errors frequently on a Mac while handling an older app. What works for me is to update the Xamarin.Build.Download
package to a slightly higher version and then back to what it was before (from 0.4.2 to 0.4.3 and back to 0.4.2 in my case). Then the app builds with no problems.
The below error is another one that changing Xamarin.Build.Download versions solves, so I'm pasting it here in case anyone else experiencing the com.google.android.gms errors encounters it next:
Error MSB4062: The "Xamarin.Build.Download.XamarinBuildAndroidAarRestore" task could not be loaded from the assembly
Upvotes: 0
Reputation: 1
Had this behavior but was because I only included Xamarin.Forms.Maps in PCL project. As soon as I added Xamarin.Forms.Maps also into Android (specially here) and iOS projects all compiled fine.
Upvotes: 0
Reputation: 360
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://learn.microsoft.com/en-us/xamarin/android/platform/maps-and-location/maps/maps-api#google-maps-api-prerequisites
Upvotes: 4
Reputation: 126
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.
Upvotes: 11
Reputation: 31
I had the same error.
For me the solution was to switch to the Visual Studio Preview Channel. I'm now on Version 15.8.0 Preview 2 and the error has gone away.
To get the Preview Channel you can download it here https://www.visualstudio.com/de/vs/preview/
Upvotes: 0