I'm brand new to Xamarin (and mobile development). I'm trying to create a simple application that uses Azure AD B2C Authentication. I'm on Windows 10 Pro using Visual Studio 2017 Community Edition. I've followed the "Installing Xamarin in Visual Studio in Windows" setup guide. I created a brand new "Cross-Platform" Xamarin Forms application, and I've successfully gotten the template application to render on the Android emulator, iOS emulator, and Xamarin Live Player (though I did have to use the TestFlight version).
Next, I started to try and implement Azure AD B2C Authentication. I mostly followed the guide called "Integrate Azure AD B2C into a Xamarin forms app using MSAL". Apparently I can't post a link in these forums yet - but if you Google it, you'll see it. Here is where I'm running into trouble. If I download the sample application listed there in GitHub, I can follow the guide and get it running. So, I know that I've successfully set up everything in Azure. However, I have never been able to get it working in my brand new application.
Whenever I make a call to AcquireTokenAsync
from within the function that handles the sign in button click, it hangs for a few seconds and then fails with the following error:
Java.Lang.NoSuchMethodError: No static method startActivity(Landroid/app/Activity;Landroid/content/Intent;Landroid/os/Bundle;)V in class Landroid/support/v4/app/ActivityCompat; or its super classes (declaration of 'android.support.v4.app.ActivityCompat' appears in /data/app/com.companyname.MobileClient-1/base.apk)
I've probably spent like 12 hours trying to figure this out on my own. I've tried updating versions of nuget packages, updating the Android stuff (platform, tools, etc...), copy/pasted code from lots of different places all over the internet... I just can't seem to figure it out. I think it's also important to point out that when Visual Studio provisions a brand new Xamarin project, it starts out with a bunch of warnings. They don't seem to impact the ability for the stock project to deploy, but maybe it's helpful to see them:
Warning NU1608 Detected package version outside of dependency constraint: Xamarin.Android.Support.CustomTabs 23.3.0 requires Xamarin.Android.Support.v4 (= 23.3.0) but version Xamarin.Android.Support.v4 25.4.0.2 was resolved.
Warning The $(TargetFrameworkVersion) for Xamarin.Forms.Platform.dll (vv8.0) is greater than the $(TargetFrameworkVersion) for your project (v7.1). You need to increase the $(TargetFrameworkVersion) for your project. MobileClient.Android
Warning The $(TargetFrameworkVersion) for Xamarin.Forms.Platform.Android.dll (vv8.0) is greater than the $(TargetFrameworkVersion) for your project (v7.1). You need to increase the $(TargetFrameworkVersion) for your project. MobileClient.Android
Warning The $(TargetFrameworkVersion) for FormsViewGroup.dll (vv8.0) is greater than the $(TargetFrameworkVersion) for your project (v7.1). You need to increase the $(TargetFrameworkVersion) for your project. MobileClient.Android
I'm about at my wits end. I would happily just use the sample project that is working, but it's using an older version of Xamarin.Forms and a "Portable" library instead of .NET Standard. I'm not sure how important either of those things are (to be honest) but I don't want to set myself up for pain down the road.
Any help would be appreciated.