Imrik
Imrik

Reputation: 664

Geolocation error, ClassNotFoundException

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

Answers (1)

W0RT4
W0RT4

Reputation: 458

Did your application works without using GeoPlugin ? If not it can be similar to this so u can try this solution. This is known issue in Xamarin android 8.1.

Upvotes: 1

Related Questions