CrossFingerprint.Current.AuthenticateAsync() throws System.InvalidOperationException: 'Expected current activity to be 'AndroidX.Fragment.App.FragmentActivity' but was '[My.App.MainActivity]'.
CNBoland opened this issue · comments
Steps to reproduce
- Upgrade Target Framework from Android 9.0 (Pie) to Android 10.0 (Q).
- Upgrade from from 1.4.9 to 2.1.1 (current version as of this writing).
- Call CrossFingerprint.Current.AuthenticateAsync(request)
Expected behavior
Fingerprint dialog should appear.
Actual behavior
Android app crashes with:
System.InvalidOperationException: 'Expected current activity to be 'AndroidX.Fragment.App.FragmentActivity' but was '[My.App.MainActivity]'. You need to use AndroidX. Have you installed Xamarin.AndroidX.Migration in your Android App project!?'
Crashlog
at Plugin.Fingerprint.FingerprintImplementation.NativeAuthenticateAsync (Plugin.Fingerprint.Abstractions.AuthenticationRequestConfiguration authRequestConfig, System.Threading.CancellationToken cancellationToken) [0x0003c] in d:\a\1\s\src\Plugin.Fingerprint\Platforms\Android\FingerprintImplementation.cs:100
at Plugin.Fingerprint.Abstractions.FingerprintImplementationBase.AuthenticateAsync (Plugin.Fingerprint.Abstractions.AuthenticationRequestConfiguration authRequestConfig, System.Threading.CancellationToken cancellationToken) [0x000e1] in d:\a\1\s\src\Plugin.Fingerprint\Abstractions\FingerprintImplementationBase.cs:24
at APA.MAP.Pages.AccountCheckPinCodePage.AuthenticateFingerPrintAsync () [0x0020c] in C:\Projects\Repos\MAP\APA.MAP\APA.MAP\APA.MAP\Pages\AccountCheckPinCodePage.xaml.cs:122
Configuration
Version of the Plugin: 2.1.1
Platform:
Platform: Android 10
Target SDK: 29
Device: Google Android emulator
Additional Info:
I do have Xamarin.AndroidX.Migration referenced, as well as keeping references to Xamarin.Android.Support.* (per Xamarin.AndroidX.Migration's README.md).
I'm also calling CrossFingerprint.SetCurrentActivityResolver(() => CrossCurrentActivity.Current.Activity); as described in documentation for this package.
Hi @CNBoland,
I'm the friendly issue checker.
It seems like (100.00 %) you haven't used our issue template 😢 I think it is very frustrating for the repository owners, if you ignore them.
If you think it's fine to make an exception, just ignore this message.
But if you think it was a mistake to delete the template, please close the issue and create a new one.
Thanks!
The problem appears to be due to my MainActivity
inheriting from Xamarin.Forms.Platform.Android.FormsApplicationActivity
rather than Xamarin.Forms.Platform.Android.FormsAppCompatActivity
, as the Android sample does.
Closing the issue.