I am in the process of updating my project to the latest Xamarin Forms/AndroidX and have hit a weird issue. We are using Material design, so we have the ContentPage set in the Styles for the app to have:
<Style x:Key="contentPageBase"
TargetType="ContentPage">
<Setter Property="BackgroundColor" Value="..."/> <!-- this uses out theme engine, I can't include that code-->
<Setter Property="Visual" Value="Material"/>
</Style>
<Style BasedOn="{StaticResource contentPageBase}"
ApplyToDerivedTypes="True"
TargetType="ContentPage"/>
When the ContentPage that contains our SfPdfViewer is shown, rather than getting a page, we get nothing at all - and the app logs the following error:
Accessing hidden field Landroid/widget/TextView;->mCursorDrawableRes:I (greylist-max-p, reflection, denied)
This is Xamarin Forms 4.8.0.1560 and Syncfusion.Xamarin.SfPdfViewer 18.3.0.38.
If I override the Visual on the ContentPage and set:
The page opens as expected.
It seems that the SfPdfViewer is somehow using a private API that was deprecated on to the greylist and is only supported up to Android P. Any ideas?
To recreate this, I would think you would create an app with Xamarin Forms 4.8.0.1560, Xamarin Forms Visual Material 4.8.0.1560, Syncfusion.Xamarin.SfPdfViewer 18.3.0.38. You would create a ContentPage that had a button bound to a Command, that Command would create a ContentPage that contains a SfPdfViewer and bunds the PDF to the InputFileStream. Run this and check it works.
You need to then add the attribute Visual="Material" to the ContentPage containing the SfPdfViewer. When you now run the app, you seem to get:
Accessing hidden field Landroid/widget/TextView;->mCursorDrawableRes:I (greylist-max-p, reflection, denied)
No page will open. This should happen even if you don't bind the control to the PDF.