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

Null DependencyService call from Android

$
0
0

Hello,

I'm referencing DependencyService implemented in a PCL project, as shown below, from a PCL.Android project, I get a System.NullReferenceException: Object reference not set to an instance of an object error.

    public static string Locale()
    {
      return DependencyService.Get<ILocale>().GetCurrent();
    }

Same code works fine with iOS and Windows Phone. Is this a bug or I’m doing something wrong?

Thanks,
Narcís


Viewing all articles
Browse latest Browse all 58056

Trending Articles



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