Skip to content

AndroidX compatibility adjustments - #23097

Merged
MartinZikmund merged 13 commits into
masterfrom
copilot/fix-missing-method-exception
May 13, 2026
Merged

MartinZikmund merged 13 commits into
masterfrom
copilot/fix-missing-method-exception

Conversation

Copilot AI commented Apr 21, 2026 •

Copy link
Copy Markdown
Contributor

AndroidX.Core 1.17.0 reshaped AccessibilityNodeInfoCompat.setChecked from setChecked(boolean) to setChecked(int) (CHECKED_STATE_FALSE/TRUE/PARTIAL). The corresponding Xamarin.AndroidX binding therefore exposes Checked as an int-typed property in Xamarin.AndroidX.AppCompat >= 1.7.1.x, while the previous binding shipped a bool setter. The Uno assemblies were compiled against the older binding, so on Android the Skia canvas view threw a MissingMethodException whenever it received accessibility focus (non-crashing but silently broken).

PR Type

  • Bugfix

What is the current behavior?

UnoExploreByTouchHelper.OnPopulateNodeForVirtualView writes node.Checked = bool, which no longer exists in AndroidX.Core >= 1.17.0:

System.MissingMethodException: Method not found: void AndroidX.Core.View.Accessibility.AccessibilityNodeInfoCompat.set_Checked(bool)

This reproduces whenever a consumer pulls Xamarin.AndroidX.Core >= 1.17.0 transitively (for example, via Sentry.Bindings.Android >= 6.3.0).

What is the new behavior?

This is not a one-line rename — the property name stayed Checked, but its type changed from bool to int. The fix has two parts:

  1. Code change in src/Uno.UI.Runtime.Skia.Android/Accessibility/UnoExploreByTouchHelper.cs: write the new int checked-state, mapping IToggleProvider.ToggleState to CHECKED_STATE_FALSE (0), CHECKED_STATE_TRUE (1), or CHECKED_STATE_PARTIAL (2) via named local constants.
- node.Checked = peer is IToggleProvider toggleProvider && toggleProvider.ToggleState == ToggleState.On;
+ node.Checked = peer switch
+ {
+     IToggleProvider { ToggleState: ToggleState.On } => CheckedStateTrue,
+     IToggleProvider { ToggleState: ToggleState.Indeterminate } => CheckedStatePartial,
+     _ => CheckedStateFalse,
+ };
  1. Dependency alignment so the binding the Uno assemblies are compiled against matches what consumers restore at runtime — without this, an app that doesn't transitively pull a newer AppCompat would hit the inverse MissingMethodException on set_Checked(int). Xamarin.AndroidX.AppCompat is now pinned to 1.7.1.2 everywhere it ships from this repo:
    • src/Directory.Build.targets for both net9.0-android and net10.0-android.
    • src/Uno.Sdk/packages.json (base and net10.0 override both 1.7.1.2).
    • build/nuget/Uno.WinUI.nuspec for both net9.0-android30.0 and net10.0-android36.0 groups.

Affects both net9.0-android and net10.0-android consumers.

Dependency cascade

Pinning AppCompat 1.7.1.2 is not a standalone change — it inherits the floor and transitive constraints of the AndroidX 1.17 release train. The following bumps are all required to keep the dependency graph internally consistent; reverting any of them re-introduces restore conflicts or a binding-vs-manifest mismatch on Android:

  • minSdk / SupportedOSPlatformVersion raised to API 23. AndroidX 1.17 defaults to minSdk 23, so pinning AppCompat 1.7.1.2 commits us to that floor. Applied to:
    • src/Uno.Sdk/targets/Uno.Common.Android.targets — the default SupportedOSPlatformVersion for all Uno.Sdk Android consumers (21.0 → 23.0).
    • src/SamplesApp/SamplesApp.netcoremobile/SamplesApp.netcoremobile.csproj and src/SamplesApp/SamplesApp.Skia.netcoremobile/SamplesApp.Skia.netcoremobile.csproj — the Android branch of the multi-targeted SamplesApps (10.0 → 23.0).
    • src/SamplesApp/SamplesApp.netcoremobile/Android/AndroidManifest.xml and src/SamplesApp/SamplesApp.Skia.netcoremobile/Android/AndroidManifest.xml — android:minSdkVersion 21 → 23. The manifest is shared across both Android TFMs of each SamplesApp, and both TFMs now ship against AppCompat 1.7.1.2, so a per-TFM 23/21 split would only desync the manifest from the bound API.
  • Transitive AndroidX bumps on net10.0-android to satisfy AppCompat 1.7.1.2:
    • Xamarin.AndroidX.Activity 1.10.1.x → 1.12.4.1 in src/Directory.Build.targets and src/Uno.Sdk/packages.json (commit 920057d6: fix(android): Bump AndroidX.Activity to satisfy AppCompat 1.7.1.2).
    • Xamarin.AndroidX.Lifecycle.LiveData 2.8.7.4 → 2.10.0.2 in src/Directory.Build.targets.
  • Xamarin.Google.Android.Play.Core 1.10.3.18 → 1.10.3.21 on net10.0-android (in src/AddIns/Uno.UI.GooglePlay/Uno.UI.GooglePlay.netcoremobile.csproj) to remain compatible with the newer AndroidX dependency graph on net10.

API 21–22 device coverage is dropped on Android as a consequence of the AndroidX 1.17 floor. This is unavoidable once Uno targets the new binding, since AccessibilityNodeInfoCompat.setChecked(int) only ships in Core 1.17+.

PR Checklist

  • Commits follow Conventional Commits.
  • Added Runtime tests / UI tests / a manual test sample for the changes (not added — accessibility node population is hard to assert in runtime tests; verified manually via TalkBack against SamplesApp).
  • Docs added / updated.
  • Validated PR Screenshots Compare Test Run results.
  • Contains NO breaking changes for consumers (the public Uno API surface is unchanged; only the AndroidX binding contract Uno targets is bumped, and the minSdk floor is raised from 21 to 23 to match the AndroidX 1.17 default).

Other information

The related issue is the MissingMethodException reported when AndroidX.Core 1.17+ is on the restore graph. After this PR, both the build-time binding and the runtime binding are aligned at AppCompat 1.7.1.2 / Core 1.17.x, and the minSdk floor matches AndroidX 1.17's default of API 23.

Copilot AI self-assigned this Apr 21, 2026
Copilot AI review requested due to automatic review settings April 21, 2026 15:30
Copilot AI removed the request for review from Copilot April 21, 2026 15:30
Copilot AI requested review from Copilot and removed request for Copilot April 21, 2026 15:31
Copilot AI changed the title [WIP] Fix MissingMethodException on accessibility focus change fix(android): use IsChecked instead of Checked on AccessibilityNodeInfoCompat for AndroidX.Core 1.17.0+ Apr 21, 2026
Copilot AI requested a review from MartinZikmund April 21, 2026 15:33
@github-actions github-actions Bot added platform/android 🤖 Categorizes an issue or PR as relevant to the Android platform area/skia ✏️ Categorizes an issue or PR as relevant to Skia labels Apr 21, 2026
Copilot AI review requested due to automatic review settings April 21, 2026 16:41
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ MartinZikmund
❌ Copilot
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions github-actions Bot added the area/sdk Categorizes an issue or PR as relevant to the Uno.Sdk label Apr 21, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes Android accessibility interop for the Skia Android runtime when running against AndroidX.Core 1.17.0+ by switching from the removed AccessibilityNodeInfoCompat.Checked API to the new IsChecked API, and updates AndroidX.AppCompat versions to align with the new dependency set.

Changes:

  • Update UnoExploreByTouchHelper to use AccessibilityNodeInfoCompat.IsChecked instead of Checked.
  • Bump Xamarin.AndroidX.AppCompat version used by repo builds for net9.0-android and net10.0-android.
  • Update Uno.Sdk package version override for Xamarin.AndroidX.AppCompat (net10).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
src/Uno.UI.Runtime.Skia.Android/Accessibility/UnoExploreByTouchHelper.cs Switch checked-state reporting to IsChecked to avoid runtime MissingMethodException on AndroidX.Core 1.17+.
src/Uno.Sdk/packages.json Updates the net10 override for AndroidX.AppCompat version used by Uno.Sdk.
src/Directory.Build.targets Aligns repo build-time AndroidX.AppCompat versions for net9/net10 Android.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Directory.Build.targets Resolved
Comment thread src/Directory.Build.targets Resolved
Comment thread src/Uno.Sdk/packages.json Resolved
@MartinZikmund
MartinZikmund marked this pull request as ready for review April 21, 2026 21:03
Copilot AI review requested due to automatic review settings April 21, 2026 21:03
@MartinZikmund
MartinZikmund enabled auto-merge April 21, 2026 21:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates Uno’s Android (Skia) accessibility virtual-view node population to remain compatible with newer AndroidX Core APIs, avoiding runtime MissingMethodException and keeping toggle/check state correctly represented.

Changes:

  • Adjust UnoExploreByTouchHelper.OnPopulateNodeForVirtualView to handle nullable AccessibilityNodeInfoCompat and update how checked state is assigned.
  • Update AndroidX AppCompat package versions (net9/net10 Android) to 1.7.1.2.
  • Update Uno.Sdk’s bundled AppCompat version override for net10.0.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
src/Uno.UI.Runtime.Skia.Android/Accessibility/UnoExploreByTouchHelper.cs Updates accessibility node population, including checked-state assignment and null handling.
src/Uno.Sdk/packages.json Bumps AppCompat version override for net10.0.
src/Directory.Build.targets Pins AndroidX AppCompat version to 1.7.1.2 for net9.0-android and net10.0-android.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Uno.Sdk/packages.json Resolved
Comment thread src/Directory.Build.targets Resolved
@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 208474 has failed on Uno.UI - CI.

@MartinZikmund

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 208757 has failed on Uno.UI - CI.

Copilot AI review requested due to automatic review settings April 23, 2026 05:53
@github-actions github-actions Bot added the area/automation Categorizes an issue or PR as relevant to project automation label Apr 23, 2026
Uno.CrossTargetting.targets is imported after the csproj body via
Directory.Build.targets, so its unconditional 21.0 assignment was
overriding the csproj-level 23.0 set in SamplesApp.*.netcoremobile.
The resulting mismatch with AndroidManifest.xml minSdkVersion=23
triggered XA1036 on every Android head.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@MartinZikmund

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 2 pipeline(s).

@MartinZikmund
MartinZikmund enabled auto-merge May 12, 2026 13:53
@unodevops

Copy link
Copy Markdown
Contributor

AppCompat 1.7.1.2 transitively pulls Compose.Runtime.Annotation 1.10.0.1,
which depends on both the .Android (AAR) and .Jvm (JAR) variants and
triggers an R8 duplicate-class error for androidx.compose.runtime.Immutable
on Android builds:

  java error JAVA0000: Type androidx.compose.runtime.Immutable is defined
  multiple times: xamarin.androidx.compose.runtime.annotation.android ...
  xamarin.androidx.compose.runtime.annotation.jvm ...

AppCompat 1.7.1.3 pulls Compose.Runtime.Annotation 1.10.4.1 transitively,
which contains the upstream fix (dotnet/android-libraries#1371) excluding
the JVM variant from Android targets.

Also bumps AndroidXActivity in Uno.Sdk/packages.json to 1.12.4.1 (matching
uno.templates) since AppCompat 1.7.1.3 transitively requires Activity
>= 1.12.4.1 - keeping the older pin would trigger NU1605 for downstream
Uno.Sdk consumers.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings May 12, 2026 17:29
@MartinZikmund

Copy link
Copy Markdown
Member

@Mergifyio backport release/stable/6.6

@mergify

mergify Bot commented May 12, 2026 •

Copy link
Copy Markdown
Contributor

backport release/stable/6.6

✅ Backports have been created

Details

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 6 comments.

Comment thread src/Directory.Build.targets Resolved
Comment thread src/Directory.Build.targets Resolved
Comment thread src/Uno.Sdk/packages.json Resolved
Comment thread build/nuget/Uno.WinUI.nuspec Resolved
Comment thread build/nuget/Uno.WinUI.nuspec Resolved
@MartinZikmund MartinZikmund changed the title fix(android): use IsChecked instead of Checked on AccessibilityNodeInfoCompat for AndroidX.Core 1.17.0+ AndroidX compatibility adjustments May 12, 2026
Match the AppCompat version already pinned in Directory.Build.targets and
Uno.Sdk/packages.json so consumers restoring Uno.WinUI get the same
AndroidX binding surface (Compose.Runtime.Annotation 1.10.4.1, which
contains the upstream fix from dotnet/android-libraries#1371).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@MartinZikmund

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 2 pipeline(s).

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 212196 found UI Test snapshots differences: skia-linux-screenshots: 61, skia-windows-screenshots: 54, wasm: 9

Details
  • skia-linux-screenshots: 61 changed over 2346

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Examples.png-dark
    • Examples.png
    • ExpanderColorValidationPage.png-dark
    • ExpanderColorValidationPage.png
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • Focus_FocusVisual_Properties.png-dark
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • ColorPickerSample.png-dark
    • ColorPickerSample.png
    • DisplayInformation.png-dark
    • ImageIconPage.png-dark
    • ImageIconPage.png
    • Buttons.png-dark
    • Buttons.png
    • ClipboardTests.png-dark
    • ImageBrush_Stretch.png-dark
    • ImageBrush_Stretch.png
    • CalendarView_Theming.png-dark
  • skia-windows-screenshots: 54 changed over 2348

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • Examples.png-dark
    • Examples.png
    • ButtonClippingTestsControl.png-dark
    • ContentPresenter_NativeEmbedding_ZIndex.png
    • CompositionEffectBrush.png-dark
    • CompositionEffectBrush.png
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • CompositionPath.png-dark
    • CompositionPath.png
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • Image_Stretch_None.png-dark
    • Image_Stretch_None.png
    • Focus_FocusVisual_Properties.png-dark
    • Path_Arc.png-dark
  • wasm: 9 changed over 1076

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • initial_state
    • MUXControlsTestApp.SwipeControlPage2
    • UITests.Shared.Microsoft_UI_Xaml_Controls.ExpanderTests.WinUIExpanderPage
    • UITests.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_NavigationProperties
    • SamplesApp.Wasm.Windows_UI_Xaml_Controls.ListView.ListView_IsSelected
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewSelectedItems
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Minimal
    • SamplesApp.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_EnableDevTools
    • UITests.Shared.Windows_UI_Xaml_Controls.ImageTests.Image_Stretch_Algmnt_Inf_Vertical

@MartinZikmund
MartinZikmund merged commit f25bc79 into master May 13, 2026
91 checks passed
@MartinZikmund
MartinZikmund deleted the copilot/fix-missing-method-exception branch May 13, 2026 03:46
MartinZikmund added a commit that referenced this pull request May 13, 2026
…g-method-exception"

This reverts commit f25bc79, reversing
changes made to 74e3d07.
MartinZikmund added a commit that referenced this pull request May 13, 2026
AndroidX.Core 1.17.0 changed the AccessibilityNodeInfoCompat.setChecked
binding from setChecked(boolean) to setChecked(int) with state constants.
When Uno.UI is compiled against one binding version and the consuming
app pulls in the other (e.g. transitively via Sentry), the managed
setter throws MissingMethodException at runtime (fixes #22999).

This calls setChecked through JNI directly, probing both Java signatures
once and dispatching to whichever the loaded binding exposes. The C#
Checked property is no longer touched, so the fix stays neutral to the
AndroidX.Core version the final app ships - no AndroidX or
SupportedOSPlatformVersion bumps required.

Alternative path to #23097, which solved the same crash by bumping
AppCompat to 1.7.1.3 and cascading the AndroidX stack to minSdk 23.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
agneszitte pushed a commit that referenced this pull request May 13, 2026
AndroidX.Core 1.17.0 changed the AccessibilityNodeInfoCompat.setChecked
binding from setChecked(boolean) to setChecked(int) with state constants.
When Uno.UI is compiled against one binding version and the consuming
app pulls in the other (e.g. transitively via Sentry), the managed
setter throws MissingMethodException at runtime (fixes #22999).

This calls setChecked through JNI directly, probing both Java signatures
once and dispatching to whichever the loaded binding exposes. The C#
Checked property is no longer touched, so the fix stays neutral to the
AndroidX.Core version the final app ships - no AndroidX or
SupportedOSPlatformVersion bumps required.

Alternative path to #23097, which solved the same crash by bumping
AppCompat to 1.7.1.3 and cascading the AndroidX stack to minSdk 23.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
agneszitte pushed a commit that referenced this pull request May 18, 2026
AndroidX.Core 1.17.0 changed the AccessibilityNodeInfoCompat.setChecked
binding from setChecked(boolean) to setChecked(int) with state constants.
When Uno.UI is compiled against one binding version and the consuming
app pulls in the other (e.g. transitively via Sentry), the managed
setter throws MissingMethodException at runtime (fixes #22999).

This calls setChecked through JNI directly, probing both Java signatures
once and dispatching to whichever the loaded binding exposes. The C#
Checked property is no longer touched, so the fix stays neutral to the
AndroidX.Core version the final app ships - no AndroidX or
SupportedOSPlatformVersion bumps required.

Alternative path to #23097, which solved the same crash by bumping
AppCompat to 1.7.1.3 and cascading the AndroidX stack to minSdk 23.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
(cherry picked from commit e933487)
MartinZikmund added a commit that referenced this pull request May 28, 2026
AndroidX.Core 1.17.0 changed the AccessibilityNodeInfoCompat.setChecked
binding from setChecked(boolean) to setChecked(int) with state constants.
When Uno.UI is compiled against one binding version and the consuming
app pulls in the other (e.g. transitively via Sentry), the managed
setter throws MissingMethodException at runtime (fixes #22999).

This calls setChecked through JNI directly, probing both Java signatures
once and dispatching to whichever the loaded binding exposes. The C#
Checked property is no longer touched, so the fix stays neutral to the
AndroidX.Core version the final app ships - no AndroidX or
SupportedOSPlatformVersion bumps required.

Alternative path to #23097, which solved the same crash by bumping
AppCompat to 1.7.1.3 and cascading the AndroidX stack to minSdk 23.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/automation Categorizes an issue or PR as relevant to project automation area/build Categorizes an issue or PR as relevant to build infrastructure area/sdk Categorizes an issue or PR as relevant to the Uno.Sdk area/skia ✏️ Categorizes an issue or PR as relevant to Skia kind/documentation platform/android 🤖 Categorizes an issue or PR as relevant to the Android platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] MissingMethodException: AccessibilityNodeInfoCompat.set_Checked with AndroidX.Core 1.17.0

7 participants