Xamarin.forms.googlemaps: Map does not show up with latest version of Xamarin.GooglePlayServices

Created on 19 Jul 2019  路  15Comments  路  Source: amay077/Xamarin.Forms.GoogleMaps

VERSIONS

  • Xamarin.Forms.GoogleMaps - 3.2.0
  • Xamarin.Forms - 4.1.0.x
  • Xamarin.GooglePlayServices - 71.x
  • Mono.Android - 9.0

PLATFORMS

  • [X] Android
  • [ ] iOS
  • [ ] UWP

ACTUAL BEHAVIOR

With latest version of Xamarin.GooglePlayServices (released yesterday), the map does not show up, it is replaced by a label "Xamarin.Forms.GoogleMaps" with a purple background.

I tested several scenario and it appears it works perfect with Xamarin.GooglePlayServices 60.x. Mono.Android 9.0 does not seem to be the guilty here.

EXPECTED BEHAVIOR

Map showing up :)

Most helpful comment

I experienced this issue, but found it was due to possible Multi-Dex setup and/or missing NuGet packages.

Needed the 4 packages listed as installed
image

Multi-Dex setup that worked
image

Hope this helps people...

All 15 comments

Please check listed below:

1. Xamarin.FormsGoogleMaps.IsInitialized returns true? in your MainActivity.cs

image

2. Dump your Application Output

Is there any log for [Google Maps Android API] ?

[Google Maps Android API] Authorization failure.  Please see https://developers.google.com/maps/documentation/android-api/start for how to correctly set up the map.
[Google Maps Android API] In the Google Developer Console (https://console.developers.google.com)
[Google Maps Android API] Ensure that the "Google Maps Android API v2" is enabled.
[Google Maps Android API] Ensure that the following Android Key exists:
[Google Maps Android API]   API Key: AIzaxxxxxxxx
[Google Maps Android API]   Android Application (<cert_fingerprint>;<package_name>): D4:C0:xxxxxx;net.amay077.xfgooglemapsample

Please check listed below:

1. Xamarin.FormsGoogleMaps.IsInitialized returns true? in your MainActivity.cs

image

2. Dump your Application Output

Is there any log for [Google Maps Android API] ?

[Google Maps Android API] Authorization failure.  Please see https://developers.google.com/maps/documentation/android-api/start for how to correctly set up the map.
[Google Maps Android API] In the Google Developer Console (https://console.developers.google.com)
[Google Maps Android API] Ensure that the "Google Maps Android API v2" is enabled.
[Google Maps Android API] Ensure that the following Android Key exists:
[Google Maps Android API]     API Key: AIzaxxxxxxxx
[Google Maps Android API]     Android Application (<cert_fingerprint>;<package_name>): D4:C0:xxxxxx;net.amay077.xfgooglemapsample

I have same problem when update google playservice. I debug follow check listed.

  1. Xamarin.FormsGoogleMaps.IsInitialized returns false in MainActivity.
  2. No any log for google map api android.

I downgrade googleplay services. Map working. Can fix this problem with new version googleplayservices ?

Sorry I can't test much more right now, but if I remember well, I did not see any suspicious log about Google Map API. The simple patch is to revert to v. 60, without touching anything else...

I am having the same issue on the Huawei Mate 20 Pro, Xamarin.FormsGoogleMaps.IsInitialized returns true in MainActivity. This issue seems to be device specific and doesn't seem to be affecting other types of phones

I create small apps for latest libs and running on AndroidP emulator.

image

Solution is here.

https://www.dropbox.com/s/zoet8ltmkkaxa8y/XFGoogleMapSample2.zip?dl=0

You should change the API KEY in MyApp.cs

Could you try this apps and tell me what different with your apps?

See Also: https://github.com/google/volley/issues/200#issuecomment-403747481

What is this MyApp.cs ? I don't have one. If I made one, where would I call it from?

Android side's MyApp.cs is Application class for your Android apps.
This is called from Android OS when app launching.

Has anyone got this working yet?

I had to drop back to Xamarin.GooglePlayServices 60.x. to make it work, so there I'll stay until you figure it out.

I experienced this issue, but found it was due to possible Multi-Dex setup and/or missing NuGet packages.

Needed the 4 packages listed as installed
image

Multi-Dex setup that worked
image

Hope this helps people...

I also had Google Maps gone on Android after updating Xamarin.GooglePlayServices.* packages from v.60.1142.1 to v.71.16xx.x.

Debug logs would show

Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.maps.model.LatLng>: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/internal/zzbck;  
...  
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.internal.zzbck" on path: DexPathList[[zip file ...]]

Downgrading Xamarin.GooglePlayServices.* packages back to v.60.1142.1 fixed the issue, however, that solution was not acceptable.

Thanks to the previous comment by @chadgruka I was able to resolve this issue by adding Xamarin.GooglePlayServices.Maps and Xamarin.GooglePlayServices.Location of v.71.16xx.x to Android project, alongside with existing
Xamarin.GooglePlayServices.Base, Xamarin.GooglePlayServices.Basement, Xamarin.GooglePlayServices.Tasks, Xamarin.GooglePlayServices.Analytics of v.71.16xx.x.

The library dependencies requires the installation of Xamarin.GooglePlayServices.Maps library v.60.1142.1, but when you have others Xamarin.GooglePlayServices dependencies with a newer version like >= v.71.16xx.x, then the Maps is not loaded in the android project.
The same thing happened to me with the Xamarin.Forms.Maps library.

The solution, like @chadgruka said, is to install the latest version of Xamarin.GooglePlayServices.Maps.

I can't reproduce.

I updated Xamarin.GooglePlayServices.* to ver 71.1610.0, but apps works fine.

image

image

My sample is here .

XFGoogleMapSample.zip

I can't investigate and fix it.

Could anyone give me minimum apps for reproduce?

To help you I was able to reproduce the issue in the following way:

First I created a project and installed Xamarin.Forms.GoogleMaps on it. It was working fine, so I decided to install Xamarin.GooglePlayServices.Auth to create a Google Authentication Login, but the installation process failed asking me to install Xamarin.GooglePlayServices.Basement and Xamarin.GooglePlayServices.Base directly in the project.

So I installed the packages in the following order:
Xamarin.GooglePlayServices.Basement
Xamarin.GooglePlayServices.Base

If I try to run the project again, the GoogleMaps will not be loaded in Android, unless I directly install Xamarin.GooglePlayServices.Maps latest version in my project.

I think the problem is that your library installs Xamarin.GooglePlayServices.Basement v.60.1142.1 and Xamarin.GooglePlayServices.Base v.60.1142.1, but if I manually update theses packages, I have to update Xamarin.GooglePlayServices.Maps as well. And this is not done automatically. The only way to do is installing it directly.

I attached my sample project in order to help with the exception;

Sorry my bad english.

TryMaps.zip

Workaround is @chadgruka's comment.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

prajithmp picture prajithmp  路  6Comments

mtsrdr picture mtsrdr  路  6Comments

talhaa91 picture talhaa91  路  4Comments

ViktorBylbas picture ViktorBylbas  路  4Comments

non335 picture non335  路  7Comments