Bug 52625 - MissingMethodException when loading maps.
Summary: MissingMethodException when loading maps.
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL: https://github.com/SpiegelSoft/Xamari...
: 52960 ()
Depends on:
Blocks:
 
Reported: 2017-02-20 01:25 UTC by Rob Lyndon
Modified: 2017-05-22 23:12 UTC (History)
31 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Rob Lyndon 2017-02-20 01:25:28 UTC
Installed NuGet packages:

Xamarin.Forms.Maps, v2.3.3.193
Xamarin.GooglePlayServices.Maps, v42.1001.0

Given the code:

type GeographicMapRenderer() =
    inherit MapRenderer()
    let mutable formsMap = Unchecked.defaultof<DashboardMap>
    let mutable googleMap = Unchecked.defaultof<GoogleMap>
    let markerViewModel = new Dictionary<string, MarkerViewModel>()
    let subscriptions = new CompositeDisposable()
    let infoWindowClicked _ (eventArgs: GoogleMap.InfoWindowClickEventArgs) = 
        eventArgs |> ignore
    let infoWindowEventHandler = new EventHandler<Android.Gms.Maps.GoogleMap.InfoWindowClickEventArgs>(infoWindowClicked)
    override this.OnElementChanged e =
        base.OnElementChanged(e)
        match box e.OldElement with
        | null -> e |> ignore
        | _ -> googleMap.InfoWindowClick.RemoveHandler infoWindowEventHandler
        match box e.NewElement with
        | null -> e |> ignore
        | _ -> formsMap <- e.NewElement :?> DashboardMap; base.Control.GetMapAsync(this)
    override __.Dispose(disposing) = if disposing then subscriptions.Clear()
    interface IOnMapReadyCallback with 
        member this.OnMapReady map =
            googleMap <- map
            let pinsUpdated _ = 
                googleMap.Clear()
                markerViewModel.Clear()
                for pin in formsMap.PinnedLocations do 
                    let marker = new MarkerOptions()
                    match pin.ViewModel.Details with
                    | SearchResult _ -> marker.SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueRed)) |> ignore
                    | PlaceOfInterest _ -> marker.SetIcon(BitmapDescriptorFactory.DefaultMarker(BitmapDescriptorFactory.HueAzure)) |> ignore
                    marker.SetPosition(new LatLng(pin.Location.Latitude / 1.0<deg>, pin.Location.Longitude / 1.0<deg>)) |> ignore
                    googleMap.AddMarker marker |> fun m -> markerViewModel.[m.Id] <- pin.ViewModel
            formsMap.PinnedLocations.ItemsAdded.ObserveOn(RxApp.MainThreadScheduler).Subscribe(pinsUpdated) |> subscriptions.Add
            formsMap.PinnedLocations.ItemsRemoved.ObserveOn(RxApp.MainThreadScheduler).Subscribe(pinsUpdated) |> subscriptions.Add
            googleMap.InfoWindowClick.AddHandler infoWindowEventHandler
            googleMap.SetInfoWindowAdapter this
    interface Android.Gms.Maps.GoogleMap.IInfoWindowAdapter with
        member this.GetInfoContents(marker: Marker): Android.Views.View = 
            marker.Title <- "Hello"
            marker.Snippet <- "World"
            let view = markerViewModel.[marker.Id] |> ViewLocator.Current.ResolveView :?> MarkerInfoWindow
            let renderer = Platform.CreateRenderer(view.Content)
            let vg = renderer.ViewGroup
            let androidView = vg :> Android.Views.View
            let height, width = androidView.Height, androidView.Width
            renderer.UpdateLayout()
            androidView.SetBackgroundColor(Android.Graphics.Color.Aqua) |> ignore
            let cc = vg.ChildCount
            let child = vg.GetChildAt(0)
            androidView
        member __.GetInfoWindow(marker: Marker): Android.Views.View = Unchecked.defaultof<Android.Views.View>
    interface IJavaObject with member __.Handle = base.Handle
    interface IDisposable with member __.Dispose() = base.Dispose()

the following error is thrown during the implementation of base.OnElementChanged():

Method 'Android.Gms.Maps.MapView.get_Map' not found.

The full project that contains the error can be found at https://github.com/SpiegelSoft/Astrid
Comment 1 Marek Habersack 2017-02-20 09:04:41 UTC
@Rob, does the error happen when the app is built in Release mode only?
Comment 2 Rob Lyndon 2017-02-20 21:46:53 UTC
Interesting. It fails to build in Release mode. Here is the error message:

Severity	Code	Description	Project	File	Line	Suppression State
Error		The "LinkAssemblies" task failed unexpectedly.
Java.Interop.Tools.Diagnostics.XamarinAndroidException: error XA2006: Reference to metadata item 'Android.Gms.Maps.GoogleMap Android.Gms.Maps.MapView::get_Map()' (defined in 'Xamarin.Forms.Maps.Android, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null') from 'Xamarin.Forms.Maps.Android, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' could not be resolved. ---> Mono.Cecil.ResolutionException: Failed to resolve Android.Gms.Maps.GoogleMap Android.Gms.Maps.MapView::get_Map()
   at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference)
   at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction)
   at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
   at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
   at Mono.Linker.Steps.MarkStep.ProcessQueue()
   at Mono.Linker.Steps.MarkStep.Process()
   at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
   at Mono.Linker.Pipeline.Process(LinkContext context)
   at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context)
   at Xamarin.Android.Tasks.LinkAssemblies.Execute()
   --- End of inner exception stack trace ---
   at Java.Interop.Tools.Diagnostics.Diagnostic.Error(Int32 code, Exception innerException, String message, Object[] args)
   at Xamarin.Android.Tasks.LinkAssemblies.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()	Astrid.Mobile.Droid	C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets	1586
Comment 3 Marek Habersack 2017-02-20 21:50:23 UTC
This might be either a bug in the linker or (more probable IMO) in the component packaging.

@Radek, @Jon can you take a look please?
Comment 4 Jon Dick 2017-02-21 13:58:40 UTC
@Rob, Xamarin.Forms.Maps v2.3.3.193 doesn't really officially support that version of Google Play Services Maps, but v2.3.4.192-pre2 does, IF your app is set to compile against (Target Framework) Android 7.0 or higher.

However, I am still seeing a linker error with this combination.  I think this might be a bug in the linker as it all builds fine without linking enabled (or with Link only sdk's enabled).

@Radek?
Comment 5 Rainer 2017-02-24 14:27:28 UTC
having the same issue
Comment 6 jacktux 2017-02-27 21:21:35 UTC
After updating to Xamarin.Forms.Maps v2.3.4.192-pre2 I am still getting the same problem.

UNHANDLED EXCEPTION:
System.MissingMethodException: Method 'Android.Gms.Maps.MapView.get_Map' not found.
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x000f4] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:190 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00027] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:131 
  at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x0001f] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\Platform.cs:289 
  at Xamarin.Forms.Platform.Android.VisualElementPackager.AddChild (Xamarin.Forms.VisualElement view, Xamarin.Forms.Platform.Android.IVisualElementRenderer oldRenderer, Xamarin.Forms.Platform.Android.RendererPool pool, System.Boolean sameChildren) [0x00023] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:84 
  at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00104] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:217 
  at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:68 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager) [0x00007] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:331 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x00111] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:193 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00027] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:131 
  at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x0001f] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\Platform.cs:289 
  at Xamarin.Forms.Platform.Android.VisualElementPackager.AddChild (Xamarin.Forms.VisualElement view, Xamarin.Forms.Platform.Android.IVisualElementRenderer oldRenderer, Xamarin.Forms.Platform.Android.RendererPool pool, System.Boolean sameChildren) [0x00023] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:84 
  at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00104] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:217 
  at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:68 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager) [0x00007] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:331 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x00111] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:193 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00027] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:131 
  at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element, Android.Support.V4.App.FragmentManager fragmentManager) [0x00031] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\Platform.cs:325 
  at Xamarin.Forms.Platform.Android.AppCompat.FragmentContainer.OnCreateView (Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Android.OS.Bundle savedInstanceState) [0x00008] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\AppCompat\FragmentContainer.cs:67 
  at Android.Support.V4.App.Fragment.n_OnCreateView_Landroid_view_LayoutInflater_Landroid_view_ViewGroup_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_inflater, System.IntPtr native_container, System.IntPtr native_savedInstanceState) [0x00022] in <7a2a36256f1648ecbd0c15a75bc5a349>:0 
  at (wrapper dynamic-method) System.Object:6bc2dd52-bba8-4b7b-ac35-af9f28f9ab13 (intptr,intptr,intptr,intptr,intptr)
Comment 7 Andrestevex 2017-02-28 14:18:26 UTC
@Jon Happens even if I disable linking or link sdk only. 

Xamarin.Forms.Maps v2.3.4.192-pre2
GooglePlayServices 32.961.0
Android.Support.* 24.2.1

Log:
System.MissingMethodException: Method 'Android.Gms.Maps.MapView.get_Map' not found.
  at RealRider.Droid.NearbyMapRenderer.OnElementChanged (Xamarin.Forms.Platform.Android.ElementChangedEventArgs`1[TElement] e) [0x00003] in /Users/Admin/Documents/[hidden for security reasons]NearbyMapRenderer.cs:39 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x000f4] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:193 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00027] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:129 
  at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x0001f] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\Platform.cs:289 
  at Xamarin.Forms.Platform.Android.VisualElementPackager.AddChild (Xamarin.Forms.VisualElement view, Xamarin.Forms.Platform.Android.IVisualElementRenderer oldRenderer, Xamarin.Forms.Platform.Android.RendererPool pool, System.Boolean sameChildren) [0x00023] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:74 
  at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00104] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:207 
  at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:58 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager) [0x00007] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:337 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x00111] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:196 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00027] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:129 
  at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x0001f] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\Platform.cs:289 
  at Xamarin.Forms.Platform.Android.VisualElementPackager.AddChild (Xamarin.Forms.VisualElement view, Xamarin.Forms.Platform.Android.IVisualElementRenderer oldRenderer, Xamarin.Forms.Platform.Android.RendererPool pool, System.Boolean sameChildren) [0x00023] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:74 
  at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00104] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:207 
  at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:58 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager) [0x00007] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:337 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x00111] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:196 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00027] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:129 
  at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x0001f] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\Platform.cs:289 
  at Xamarin.Forms.Platform.Android.VisualElementPackager.AddChild (Xamarin.Forms.VisualElement view, Xamarin.Forms.Platform.Android.IVisualElementRenderer oldRenderer, Xamarin.Forms.Platform.Android.RendererPool pool, System.Boolean sameChildren) [0x00023] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:74 
  at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00104] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:207 
  at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:58 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager) [0x00007] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:337 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x00111] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:196 
  at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00027] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:129 
  at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element, Android.Support.V4.App.FragmentManager fragmentManager) [0x00031] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\Platform.cs:325 
  at Xamarin.Forms.Platform.Android.AppCompat.FragmentContainer.OnCreateView (Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Android.OS.Bundle savedInstanceState) [0x00008] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\AppCompat\FragmentContainer.cs:66 
  at Android.Support.V4.App.Fragment.n_OnCreateView_Landroid_view_LayoutInflater_Landroid_view_ViewGroup_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_inflater, System.IntPtr native_container, System.IntPtr native_savedInstanceState) [0x00022] in <6296d3d76c5d4378959a1d9bf7205023>:0 
  at (wrapper dynamic-method) System.Object:a28a7aa7-0fb9-4295-9c78-a859f4789148 (intptr,intptr,intptr,intptr,intptr)
Comment 8 Andrestevex 2017-02-28 15:48:29 UTC
@Jon Sorry for earlier, builds fine if I disable linking but crashes in code when running.
Comment 9 Josh Willis 2017-02-28 20:28:09 UTC
Can confirm I'm seeing the same issue. Builds just fine but App crashes when Map loads. Tried pre releases of Xamarin.Forms.Maps & Xamarin.GooglePlayServices.Maps along with different SDK targets with no difference in results.
Comment 10 dhaligas 2017-03-01 17:05:17 UTC
I can confirm this too.
Comment 11 VBH 2017-03-01 17:58:29 UTC
I can confirm that there is a hard dependency between 

Xamarin.Forms.Maps, v2.3.3.193
and
Xamarin.GooglePlayServices.Maps, 29.0.0.1

To use Firebase CM, min version for Xamarin.GooglePlayServices.Maps is 29.0.0.2.

As a result, Firebase CM cannot be used.  This is show stopper for us and needs to be fixed ASAP.
Comment 12 David Ortinau [MSFT] 2017-03-02 01:11:02 UTC
*** Bug 52960 has been marked as a duplicate of this bug. ***
Comment 13 Jon Dick 2017-03-02 03:28:34 UTC
Looks like the main issue here is that Google removed their java `getMap` method which had been obsoleted for some time (even in 29.0.0.1 you can see the equivalent `Map` property is marked obsolete), and they finally removed it some time around v9.6.1 of play services.

The Forms renderer uses the `Map` property (so the underlying java `getMap` method), which no longer exists in newer versions of play services, so we are seeing this crash.  The Forms renderer will need to change to use the `GetMapAsync` method.  If you wanted to you could always go grab the renderer source code and update it yourself to use this and use it as a custom renderer for now.

I believe the forms team is working on an update for this.
Comment 14 Andrestevex 2017-03-02 13:29:34 UTC
@Jon Where can one find that renderer? Tried in github but could not find it.
Comment 15 Rob Lyndon 2017-03-02 13:31:06 UTC
@Andrestevex I'll write one tonight and add put it on Nuget.
Comment 16 dhaligas 2017-03-02 18:53:51 UTC
@David what is the status of this?
Comment 17 Rob Lyndon 2017-03-03 02:48:48 UTC
I've published a workaround to Nuget: https://www.nuget.org/packages/XamarinForms.Maps.Android.TemporaryPatch/0.0.0.1

The source code is up at https://github.com/SpiegelSoft/XamarinForms.Maps.Android.TemporaryPatch

I have been struggling to test this, because I've got another nasty show-stopping bug (https://bugzilla.xamarin.com/show_bug.cgi?id=52738), so this should be taken only as a first attempt, rather than anything production-ready.

To use this patch, replace your uses of Map, Pin and MapRenderer with their namesakes in the XamarinForms.Maps.Android.TemporaryPatch namespace.

Drop me an email if you'd like me to add you as a collaborator in the repository.
Comment 18 Mauricio Bernardo 2017-03-03 16:27:39 UTC
I`m having the same problem. I did not understand how to use this TemporaryPatch. I have a Xamarin.Forms Project and when I run the Android version it crashes with this same message when a load a page with the map. I added this package to the Android project but I don't have any renderer for this page. This patch is applied in my case? Should I downgrade Xamarin.Forms?
Comment 19 Rob Lyndon 2017-03-03 16:47:01 UTC
You need to add

using Map = XamarinForms.Maps.Android.TemporaryPatch.Map;
using MapRenderer = XamarinForms.Maps.Android.TemporaryPatch.MapRenderer;

[assembly: ExportRenderer (typeof (Map), typeof (MapRenderer))]

to your MainActivity class.

You also need to replace your existing Map instances with the patched Map class XamarinForms.Maps.Android.TemporaryPatch.Map.
Comment 20 Rob Lyndon 2017-03-03 16:48:39 UTC
I only knocked this together after work last night. I'll probably put out some updates over the weekend.
Comment 21 Rob Lyndon 2017-03-04 22:38:51 UTC
So I've managed to test and fix the XamarinForms.Maps.Android.TemporaryPatch NuGet package. You no longer need to replace the Map or Pin class: just the renderer (I'm using reflection to access internal properties in those classes).

Add the following attribute to your main activity:

[assembly: ExportRenderer (typeof (Map), typeof (XamarinForms.Maps.Android.TemporaryPatch.MapRenderer))]
Comment 22 Mauricio Bernardo 2017-03-05 16:26:27 UTC
Hi Rob,

I tried to use your patch and also added the map renderer directly to my android project but in both cases looks like the rendered class is not being instantiated. Any ideas? The map 1`m using is defined in the XAML in Xamarin.Forms.

The definitive solution will be a release of a new version ox Xamarin.Forms.Maps? How long normally it takes?
Comment 23 Rob Lyndon 2017-03-05 16:41:37 UTC
@Mauricio -- which version of the NuGet package are you using? The working version right now writing is 1.0.0.1.
Comment 24 Mauricio Bernardo 2017-03-05 16:48:48 UTC
I`m using the latest 1.0.0.1
Comment 25 Rob Lyndon 2017-03-05 17:14:50 UTC
Have a look at the Android project in https://github.com/SpiegelSoft/Astrid. It's in F#, but should be readable enough.

You can create a custom renderer that derives from the patched renderer, and set a breakpoint to check that it being instantiated.
Comment 26 Juanu Haedo 2017-03-05 21:54:44 UTC
Just as Mauricio, I still get the same error.
I tried to use the nuget package as well as putting the code as a custom renderer on my project, but the error is still there.

Coul it be that Xamarin is not using the custom renderer?
Comment 27 Juanu Haedo 2017-03-05 22:01:17 UTC
I can confirm that the CustomRenderer is not being called. 


I've added the [assembly: ExportRenderer(typeof(Map), typeof(MapRenderer))] attribute but it's still not paying any attention to it.

Here is the output:

System.MissingMethodException: Method 'Android.Gms.Maps.MapView.get_Map' not found.
03-05 18:50:52.998 I/MonoDroid(14936):   at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x000f4] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:193 
03-05 18:50:52.998 I/MonoDroid(14936):   at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00027] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:129 
03-05 18:50:52.998 I/MonoDroid(14936):   at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x0001f] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\Platform.cs:289 
03-05 18:50:52.998 I/MonoDroid(14936):   at Xamarin.Forms.Platform.Android.VisualElementPackager.AddChild (Xamarin.Forms.VisualElement view, Xamarin.Forms.Platform.Android.IVisualElementRenderer oldRenderer, Xamarin.Forms.Platform.Android.RendererPool pool, System.Boolean sameChildren) [0x00023] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:74 
03-05 18:50:52.998 I/MonoDroid(14936):   at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00104] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:207 
03-05 18:50:52.998 I/MonoDroid(14936):   at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:58 
03-05 18:50:52.998 I/MonoDroid(14936):   at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager) [0x00007] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:337 
03-05 18:50:52.998 I/MonoDroid(14936):   at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x00111] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:196 
03-05 18:50:52.998 I/MonoDroid(14936):   at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00027] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:129 
03-05 18:50:52.998 I/MonoDroid(14936):   at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x0001f] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\Platform.cs:289 
03-05 18:50:52.998 I/MonoDroid(14936):   at Xamarin.Forms.Platform.Android.VisualElementPackager.AddChild (Xamarin.Forms.VisualElement view, Xamarin.Forms.Platform.Android.IVisualElementRenderer oldRenderer, Xamarin.Forms.Platform.Android.RendererPool pool, System.Boolean sameChildren) [0x00023] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:74 
03-05 18:50:52.998 I/MonoDroid(14936):   at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00104] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:207 
03-05 18:50:52.998 I/MonoDroid(14936):   at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:58 
03-05 18:50:52.998 I/MonoDroid(14936):   at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager) [0x00007] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:337 
03-05 18:50:52.998 I/MonoDroid(14936):   at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x00111] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:196 
03-05 18:50:52.998 I/MonoDroid(14936):   at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00027] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:129 
03-05 18:50:52.998 I/MonoDroid(14936):   at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x0001f] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\Platform.cs:289 
03-05 18:50:52.998 I/MonoDroid(14936):   at Xamarin.Forms.Platform.Android.VisualElementPackager.AddChild (Xamarin.Forms.VisualElement view, Xamarin.Forms.Platform.Android.IVisualElementRenderer oldRenderer, Xamarin.Forms.Platform.Android.RendererPool pool, System.Boolean sameChildren) [0x00023] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:74 
03-05 18:50:52.998 I/MonoDroid(14936):   at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00104] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:207 
03-05 18:50:52.998 I/MonoDroid(14936):   at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:58 
03-05 18:50:52.998 I/MonoDroid(14936):   at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager) [0x00007] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:337 
03-05 18:50:52.998 I/MonoDroid(14936):   at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x00111] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:196 
03-05 18:50:52.998 I/MonoDroid(14936):   at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00027] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:129 
03-05 18:50:52.998 I/MonoDroid(14936):   at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x0001f] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\Platform.cs:289 
03-05 18:50:52.998 I/MonoDroid(14936):   at Xamarin.Forms.Platform.Android.VisualElementPackager.AddChild (Xamarin.Forms.VisualElement view, Xamarin.Forms.Platform.Android.IVisualElementRenderer oldRenderer, Xamarin.Forms.Platform.Android.RendererPool pool, System.Boolean sameChildren) [0x00023] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:74 
03-05 18:50:52.998 I/MonoDroid(14936):   at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00104] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:207 
03-05 18:50:52.998 I/MonoDroid(14936):   at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:58 
03-05 18:50:52.998 I/MonoDroid(14936):   at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager) [0x00007] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:337 
03-05 18:50:52.998 I/MonoDroid(14936):   at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x00111] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:196 
03-05 18:50:52.998 I/MonoDroid(14936):   at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00027] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:129 
03-05 18:50:52.998 I/MonoDroid(14936):   at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x0001f] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\Platform.cs:289 
03-05 18:50:52.998 I/MonoDroid(14936):   at Xamarin.Forms.Platform.Android.VisualElementPackager.AddChild (Xamarin.Forms.VisualElement view, Xamarin.Forms.Platform.Android.IVisualElementRenderer oldRenderer, Xamarin.Forms.Platform.Android.RendererPool pool, System.Boolean sameChildren) [0x00023] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:74 
03-05 18:50:52.998 I/MonoDroid(14936):   at Xamarin.Forms.Platform.Android.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00104] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:207 
03-05 18:50:52.998 I/MonoDroid(14936):   at Xamarin.Forms.Platform.Android.VisualElementPackager.Load () [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementPackager.cs:58 
03-05 18:50:52.999 I/MonoDroid(14936):   at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetPackager (Xamarin.Forms.Platform.Android.VisualElementPackager packager) [0x00007] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:337 
03-05 18:50:52.999 I/MonoDroid(14936):   at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x00111] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:196 
03-05 18:50:52.999 I/MonoDroid(14936):   at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00027] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\VisualElementRenderer.cs:129 
03-05 18:50:52.999 I/MonoDroid(14936):   at Xamarin.Forms.Platform.Android.Platform.CreateRenderer (Xamarin.Forms.VisualElement element, Android.Support.V4.App.FragmentManager fragmentManager) [0x00031] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\Platform.cs:325 
03-05 18:50:52.999 I/MonoDroid(14936):   at Xamarin.Forms.Platform.Android.AppCompat.FragmentContainer.OnCreateView (Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Android.OS.Bundle savedInstanceState) [0x00008] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.Android\AppCompat\FragmentContainer.cs:66 
03-05 18:50:52.999 I/MonoDroid(14936):   at Android.Support.V4.App.Fragment.n_OnCreateView_Landroid_view_LayoutInflater_Landroid_view_ViewGroup_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_inflater, System.IntPtr native_container, System.IntPtr native_savedInstanceState) [0x00022] in <7a2a36256f1648ecbd0c15a75bc5a349>:0 
03-05 18:50:52.999 I/MonoDroid(14936):   at (wrapper dynamic-method) System.Object:2d6dda9f-e614-41aa-bfcc-2a796aca3400 (intptr,intptr,intptr,intptr,intptr)
Comment 28 Rob Lyndon 2017-03-05 22:09:06 UTC
Remember, the bugfix MapRenderer has the same name as the original MapRenderer. You need the qualified name:

[assembly: ExportRenderer (typeof (Map), typeof (XamarinForms.Maps.Android.TemporaryPatch.MapRenderer))]

not

[assembly: ExportRenderer (typeof (Map), typeof (MapRenderer))]

as the latter will pick up the default renderer (the one with the bug).
Comment 29 Juanu Haedo 2017-03-05 22:18:17 UTC
I made sure that the Type that was being called was the Custom renderer, but just in case something was wrong, I just tried with the qualified name, but the error is still there.

It seems that Xamarin.Forms is not paying any attention to the ExportRenderer attribute (placed on MainActivity.cs).

Should I change anything on my Xaml?
Comment 30 Rob Lyndon 2017-03-05 22:42:15 UTC
Can you email me the relevant part of your XAML? Email address in the link on my name.
Comment 31 Philipp Sumi 2017-03-05 22:47:04 UTC
If you just subclass Map with your own, you should be fine I think.


[assembly: ExportRenderer (typeof (MyClassExtendingMap), typeof (XamarinForms.Maps.Android.TemporaryPatch.MapRenderer))]
Comment 32 Juanu Haedo 2017-03-05 22:57:14 UTC
Nailed it!

On my Portable project I created a sub class for map:

public class CustomMap : Xamarin.Forms.Maps.Map {}

And on the Droid project [assembly: ExportRenderer (typeof (MyClassExtendingMap), typeof (XamarinForms.Maps.Android.TemporaryPatch.MapRenderer))]

Last, on the XAML of my portable project I changed the map reference to use the custom map class:

From: xmlns:maps="clr-namespace:Xamarin.Forms.Maps;assembly=Xamarin.Forms.Maps" to xmlns:maps="clr-namespace:MyAssembly.CustomClassNamespace;assembly=MyAssembly"

Thanks Rob!

I will be waiting for the fix!
Comment 33 Rob Lyndon 2017-03-05 23:01:03 UTC
Thanks guys. I'll try and fix the fix tonight.
Comment 34 Mauricio Bernardo 2017-03-05 23:38:24 UTC
Great ideia! Worked for me too! Thank you very much Juanu and Rob!
Comment 35 Mauricio Bernardo 2017-03-05 23:40:32 UTC
I forgot to mention Phillip! Thank you too!
Comment 36 Rob Lyndon 2017-03-06 00:07:34 UTC
I've just released another version.

In your map setup, you need to add an extra line:

Xamarin.FormsMaps.Init(this, bundle);
XamarinForms.Maps.Android.TemporaryPatch.MapRendererConstants.Bundle = bundle;

This is because the FormsMaps initialisation sets the static Bundle property on the default renderer, and we also need to do this with the custom renderer.

Also, I've just realised that you need to add the [ExportRenderer] attribute to the namespace, not the MainActivity class. Does anyone have any time to check if the custom renderer works without subclassing the Map, as long as the [ExportRenderer] attribute is added in the correct location?
Comment 37 Laura 2017-03-07 03:29:18 UTC
My attribute is in the right location, but using the vanilla map class doesn't solve the issue.
Comment 38 Rob Lyndon 2017-03-07 03:41:11 UTC
Looking at the documentation (https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/custom-renderer/map/), it looks like it may be necessary to subclass the Map; registering a new renderer does not seem to unregister the old one.

I'll check the Xamarin.Forms code to verify this, but it will have to wait for  a couple of days.
Comment 39 Shingo Inoue 2017-03-07 07:39:16 UTC
Hi Rob,

I tried to install 'XamarinForms.Maps.Android.TemporaryPatch 1.0.0.2', but I couldn't.

The message is as shown below.

"You are trying to install this package into a project that targets 'MonoAndroid,Version=v7.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 don't know what should I do.

Please advise me.
Comment 40 Rob Lyndon 2017-03-07 08:10:02 UTC
What is the target framework in your project? Mine is

<TargetFrameworkVersion>v7.1</TargetFrameworkVersion>
Comment 41 Shingo Inoue 2017-03-07 09:30:45 UTC
Hello, Rob,

Thank you very much.
Comment 42 Andrestevex 2017-03-07 10:13:00 UTC
Thanks @Rob for the patch. Very very helpful.
Comment 43 Shingo Inoue 2017-03-09 06:13:00 UTC
I tried release build, but it was not successful.

Here is the output:

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: Error: Error executing task LinkAssemblies: error XA2006: Could not resolve reference to 'Android.Gms.Maps.GoogleMap Android.Gms.Maps.MapView::get_Map()' (defined in assembly 'Xamarin.Forms.Maps.Android, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null') with scope 'Xamarin.GooglePlayServices.Maps, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. When the scope is different from the defining assembly, it usually means that the type is forwarded.
Comment 44 Rob Lyndon 2017-03-09 08:11:14 UTC
@Shingo -- have you subclassed the Map, and exported the new renderer?
Comment 45 Shingo Inoue 2017-03-09 09:42:19 UTC
@Rob Thank you.

I am using your "MapRenderer.cs" directly in the Droid project, because I need to add some code.

It works perfect in debug mode.

Here is my code.

// In PCL
namespace MyNameSpace.PCL.Controls
{
	public class ExtendedMap : Map
	{
		.....
	}
}


// In Droid project 
[assembly: ExportRenderer(typeof(ExtendedMap), typeof(XamarinForms.Maps.Android.TemporaryPatch.MapRenderer))]
namespace MyNameSpace.Droid.Renderers
{
	public class ExtendedMapRenderer : XamarinForms.Maps.Android.TemporaryPatch.MapRenderer, GoogleMap.IOnMapClickListener, GoogleMap.IOnMarkerClickListener, IOnMapReadyCallback
	{
		.....
	}
}
Comment 46 Rob Lyndon 2017-03-09 10:47:12 UTC
For now, you'll have to change the Linker to "None" (Project Properties -> Android Options -> Linker). Once the official fix for Xamarin Forms is published, you'll be able to link SDK Assemblies (and user assemblies if necessary).
Comment 47 Shingo Inoue 2017-03-09 11:35:43 UTC
@Rob

I have succeeded in release build. Thank you.
Comment 48 Kent 2017-03-15 23:48:29 UTC
Why is this marked as NEEDINFO? Can someone set it to CONFIRMED please? In my experience, this will be ignored if it's left in NEEDINFO state.
Comment 49 Kent 2017-03-15 23:54:42 UTC
By the way, I tried replacing the renderer to work around this problem. Indeed, my map now displays without crashing. However, all customizations to behavior we had (zooming to region, disabling user interaction) are now broken. Haven't investigated why yet, but this is a whole bunch of work we weren't expecting to have to deal with :(
Comment 50 dhaligas 2017-03-16 02:34:18 UTC
I agree this is ridiculous that this hasn't been addressed.  I just grabbed the Maps code and brought it into my app and fixed it there.
Comment 51 Rob Lyndon 2017-03-17 21:13:29 UTC
I'm changing this to "CONFIRMED" myself, as it has been confirmed multiple times in this thread.
Comment 52 Didac Punyet 2017-03-19 23:39:31 UTC
I'm having the same problem that @Kent has. I can use Rob's patch, but i have to reimplement all my custom functionality, but i'm afraid once Xamarin releases a fix, i'll had to rewrite it again
Comment 53 Antonio Ibarra 2017-03-20 12:18:36 UTC
How we can change the component type? Because this is not a linker bug. And (I think) because of it, never will be assigned to the correct people.
Comment 54 Rob Lyndon 2017-03-20 12:22:41 UTC
I've changed it.
Comment 55 Antonio Ibarra 2017-03-20 12:28:49 UTC
Thanks, I am thinking that this is a Binding problem, but ACL Integration can be OK.

You can also change the assignee to Marek Habersack?
Comment 56 Rob Lyndon 2017-03-20 12:37:07 UTC
I can't change the assignee, I'm afraid.

Is there anyone from Xamarin on this thread?
Comment 57 Jon Dick 2017-03-20 16:04:18 UTC
I'm checking in with the Forms team to see the status of this now.
Comment 58 David Ortinau [MSFT] 2017-03-20 18:40:16 UTC
https://github.com/xamarin/Xamarin.Forms/pull/824

This will be in the next 2.3.4-pre. We are preparing that for release now.
Comment 59 Rob Lyndon 2017-03-20 19:03:27 UTC
Thanks David.
Comment 60 Rob Lyndon 2017-03-23 12:41:55 UTC
If people are having any problems implementing my patch, try adding the line

    XamarinForms.Maps.Android.TemporaryPatch.MapRendererConstants.Bundle = bundle;

to your MainActivity class.
Comment 61 aman 2017-03-31 18:23:59 UTC
Hi

@Rob
m still getting the same issue

1.Firstly i created class in portble xamarin project

namespace customMapNamespace
{
   public class customMap : Xamarin.Forms.GoogleMaps.Map 
    {
    }
}

2.I added the maprenderer.cs directly in droid project as m unable to get temporary patch from nuget , getting some error

3. i main activity above namespace , write 
[assembly: ExportRenderer(typeof(customMapNamespace.customMap), typeof(XamarinForms.Maps.Android.TemporaryPatch.MapRenderer))]

and one line added

Xamarin.FormsGoogleMaps.Init(this, bundle); // initialize for Xamarin.Forms.GoogleMaps
           XamarinForms.Maps.Android.TemporaryPatch.MapRendererConstants.Bundle = bundle;

============
clean and rebuild and still the same error
"Java.Interop.Tools.Diagnostics.XamarinAndroidException: error XA2006: Could not resolve reference to 'Android.Gms.Maps.GoogleMap Android.Gms.Maps.MapView::get_Map()' (defined in assembly 'Xamarin.Forms.GoogleMaps.Android, Version=1.7.1.0, Culture=neutral, PublicKeyToken=null') with scope 'Xamarin.GooglePlayServices.Maps, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. When the scope is different from the defining assembly, it usually means that the type is forwarded. ---> Mono.Cecil.ResolutionException: Failed to resolve Android.Gms.Maps.GoogleMap Android.Gms.Maps.MapView::get_Map()
"

where am I  doing wrong ? m stuck here past few days. guide me please
Comment 62 aman 2017-03-31 18:26:30 UTC
Worth mentioning
===============
I have google play services.location package is also installed. before its installation everything was working fine. but after google play sercices location package installation , it is showing me this error
Comment 63 Rob Lyndon 2017-04-01 11:37:03 UTC
You need to inherit from Xamarin.Forms.Map, not Xamarin.Forms.GoogleMaps.Map.
Comment 64 aman 2017-04-03 05:54:00 UTC
Ok , I will try it and let you know the results
Comment 65 aman 2017-04-03 06:05:33 UTC
hi @Rob

I changed my google maps to xamarin.forms.maps , but still m getting the same error
"
Severity	Code	Description	Project	File	Line	Suppression State
Error		The "LinkAssemblies" task failed unexpectedly.
Java.Interop.Tools.Diagnostics.XamarinAndroidException: error XA2006: Could not resolve reference to 'Android.Gms.Maps.GoogleMap Android.Gms.Maps.MapView::get_Map()' (defined in assembly 'Xamarin.Forms.Maps.Android, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null') with scope 'Xamarin.GooglePlayServices.Maps, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. When the scope is different from the defining assembly, it usually means that the type is forwarded. ---> Mono.Cecil.ResolutionException: Failed to resolve Android.Gms.Maps.GoogleMap Android.Gms.Maps.MapView::get_Map()
   at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference)
   at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction)
   at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
   at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
   at Mono.Linker.Steps.MarkStep.ProcessQueue()
   at Mono.Linker.Steps.MarkStep.Process()
   at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
   at MonoDroid.Tuner.MonoDroidMarkStep.Process(LinkContext context)
   at Mono.Linker.Pipeline.Process(LinkContext context)
   at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context)
   at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
   --- End of inner exception stack trace ---
   at Java.Interop.Tools.Diagnostics.Diagnostic.Error(Int32 code, Exception innerException, String message, Object[] args)
   at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
   at Xamarin.Android.Tasks.LinkAssemblies.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()


plz help
Comment 66 Rob Lyndon 2017-04-04 09:11:39 UTC
@aman -- you need to turn the linker off. See Comment 46, https://bugzilla.xamarin.com/show_bug.cgi?id=52625#c46
Comment 67 Kent 2017-04-04 09:15:43 UTC
Isn't this all moot? The latest pre-release fixes the map renderer.
Comment 68 aman 2017-04-05 04:54:52 UTC
@Rob , i turned the linker off , but after deploying the application with linker off , it crashes. Uhh.. dont know what to do
Comment 69 Rob Lyndon 2017-04-07 10:08:17 UTC
It's totally moot now. I've unlisted the NuGet package. My advice is to uninstall it and update the Xamarin Forms NuGet packages.
Comment 70 Shingo Inoue 2017-04-14 14:21:54 UTC
Have you tried the new Xamarin.Forms.Maps?
After MoveToRegion, VisibleRegion remains null.
Comment 71 Jason Smith [MSFT] 2017-05-22 22:07:24 UTC
This should be fixed in the current stable release.
Comment 72 Rob Lyndon 2017-05-22 22:50:38 UTC
I can confirm that it is fixed.
Comment 73 Roger Leblanc 2017-05-22 23:12:50 UTC
I also confirm that it is fixed with current stable release.