Reputation: 664
I am working on a Xamarin Cross Platform App and I have a problem when I try to obtain my gps coords. I have this code to get the gps information:
protected async override void OnAppearing()
{
position = await GetPosition();
map.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(position.Latitude, position.Longitude), Distance.FromMiles(0.3)));
}
async Task<Plugin.Geolocator.Abstractions.Position> GetPosition()
{
var locator = CrossGeolocator.Current;
locator.DesiredAccuracy = 50;
Plugin.Geolocator.Abstractions.Position position = await locator.GetPositionAsync(TimeSpan.FromSeconds(5));
return position;
}
When it reaches the line:
Plugin.Geolocator.Abstractions.Position position = await locator.GetPositionAsync(TimeSpan.FromSeconds(5));
It gives me this exception:
Java.Lang.ClassNotFoundException: Didn't find class "md57251f317a80041e1a60080af127573bd.GeolocationSingleListener" on path: DexPathList[[zip file "/data/app/com.companyname.PruebaMapas-1/base.apk"],nativeLibraryDirectories=[/data/app/com.companyname.PruebaMapas-1/lib/x86, /system/fake-libs, /data/app/com.companyname.PruebaMapas-1/base.apk!/lib/x86, /system/lib, /vendor/lib]]
I don't know why. I add the "Plugin.Geolocator" using NuGet and it is on my PruebaMapas project and on my PruebaMapas.Android project too.
Can anyone help me? Thanks a lot!
Upvotes: 0
Views: 225