-
Notifications
You must be signed in to change notification settings - Fork 742
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android Migrate off mCursorDrawableRes (setting cursor color on TextView) as throws error in api 29 and higher #6240
Comments
Thanks for the report! Curiously, this is not something that we've seen recently in apps running even on recent devices. Is this preventing the app from running, or you've only seen this message in the logs? |
it does not prevent it running, it throws a hard exception in visual studio when debugging and I would assume the code doesn't work given the fact it is blacklisted now that uno targets 29. |
Sorry I misunderstood the android sdk targetting vs minimum sdk version (or really min platform). As uno supports back to Android 5 the existing api switch would need expanding along with some re-work: uno/src/Uno.UI/UI/Xaml/Controls/TextBox/TextBoxView.Android.cs Lines 145 to 153 in 14c3ae6
Adding one for 29 and higher using the new SetTextCursorDrawable. The main thing would be removing the initial call to get the old mCursorDrawableRes unless version < 29 to avoid the error. |
Thanks for the investigations! Indeed this was probably done prior to API 29, where there was no replacement for this API. |
Current behavior
an exception thrown on access:
Accessing hidden field Landroid/widget/TextView;->mCursorDrawableRes:I (greylist-max-p, reflection, denied) **Java.Lang.NoSuchFieldException:** 'No field mCursorDrawableRes in class Landroid/widget/TextView; (declaration of 'android.widget.TextView' appears in /system/framework/framework.jar!classes3.dex)'
Summary
So
uno/src/Uno.UI/UI/Xaml/Controls/TextBox/TextBoxView.Android.cs
Line 139 in 14c3ae6
This is referenced in #5491 however the PR does not remove the access to this field rather more error handling.
Officially I think the recommendation is: https://developer.android.com/reference/android/widget/TextView#setTextCursorDrawable(int) it was only added in v29 however I understand that is now the minimum version for uno anyway so could probably just swap over to using it exclusively.
The text was updated successfully, but these errors were encountered: