Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 75885

Xamarin Forms Maps crashing without any warning

$
0
0

Hello, I developed a multi-page xamarin forms application (PCL), and I'm debugging it on a Nexus 5. After some nested pages in a menu I must load a page with a map. For a first try I tried the code in the MobileCRM example:

    public class MapPage : ContentPage {
            public MapPage() {
                        var map = new Map(MapSpan.FromCenterAndRadius(new Position(37,-122), Distance.FromMiles(0.3))) {
                            IsShowingUser = true,
                            HeightRequest = 100,        // I even tried without binding the dimensions, but it doesn't work either
                            WidthRequest = 960,     //
                            VerticalOptions = LayoutOptions.FillAndExpand
                    };
                    var stack = new StackLayout { Spacing = 0 };
                    stack.Children.Add(map);
                    Content = stack;
            }
    }

But the app crashes as soon as I navigate to that page. I don't even get anything from the console, the app just closes ("unfortunately app has stopped working") and the debug stops wthout saying anything.

I already have a working google maps v2 key, already tested on the MobileCRM example (it works!), and the name of my app's package is correct both in the google developer console and my xamarin project (no uppercase characters used), and I already put the maps init() in the mainActivity, the NETWORK_STATE and INTERNET permissions in the manifest and the correct "using" in every file that needs it.

I tried the MobileCRM example in a separate project and it worked. I thought it might be a problem of updated packages and/or target framework, so I updated all the packages in the example, and changed the target framework to latest available (Lollipop). The mobileCRM example still works. My application doesn't, and it uses the exact same package versions, same target framework and same code. What's wrong?

I noticed the CRM example uses a shared project instead of a PCL, is there some reference I must keep in mind when using the code I posted above, aside from xamarin.forms.maps?


Viewing all articles
Browse latest Browse all 75885

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>