Skip to content

AndroidX compatibility adjustments (backport #23097)#23259

Open
mergify[bot] wants to merge 13 commits into
release/stable/6.6from
mergify/bp/release/stable/6.6/pr-23097
Open

AndroidX compatibility adjustments (backport #23097)#23259
mergify[bot] wants to merge 13 commits into
release/stable/6.6from
mergify/bp/release/stable/6.6/pr-23097

Conversation

@mergify
Copy link
Copy Markdown
Contributor

@mergify mergify Bot commented May 13, 2026

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.023.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.023.0).
    • src/SamplesApp/SamplesApp.netcoremobile/Android/AndroidManifest.xml and src/SamplesApp/SamplesApp.Skia.netcoremobile/Android/AndroidManifest.xmlandroid:minSdkVersion 2123. 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.x1.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.42.10.0.2 in src/Directory.Build.targets.
  • Xamarin.Google.Android.Play.Core 1.10.3.181.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.


This is an automatic backport of pull request #23097 done by Mergify.

Copilot AI and others added 13 commits May 13, 2026 03:46
…ore 1.17.0 compat

Agent-Logs-Url: https://github.com/unoplatform/uno/sessions/6a919534-1066-4b51-844a-21ba5ac171cb

Co-authored-by: MartinZikmund <1075116+MartinZikmund@users.noreply.github.com>
(cherry picked from commit 1f56595)
(cherry picked from commit e818084)
…nding

- IsChecked is now a read-only bool property; use the new int-based Checked property with CHECKED_STATE_* values (0/1/2), also surfacing Indeterminate as PARTIAL
- OnPopulateNodeForVirtualView override now accepts a nullable node to match the updated binding signature
- Suppress CS0618 on SetLabeledBy(View, int): AddLabeledBy is only effective on API 36+ and has no list-based equivalent for virtual-view labeling

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
(cherry picked from commit 4590d1b)
- Raise AndroidXAppCompat default in packages.json from 1.7.0.7 to
  1.7.1.2 so net9.0-android consumers of Uno.Sdk.Private (including the
  uno56droidioswasmskia 5.6 template) stop hitting NU1605 against the
  freshly built Uno.WinUI.Runtime.Skia.Android.

Relates to #22999.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
(cherry picked from commit 5dd7505)
(cherry picked from commit 386f515)
(cherry picked from commit 5c73f39)
(cherry picked from commit 0a28741)
(cherry picked from commit 1a9ec0f)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
(cherry picked from commit f7765c9)
AppCompat 1.7.1.2 transitively requires Xamarin.AndroidX.Activity
>= 1.12.2.1. The Uno.Sdk implicit package list and Uno.WinUI nuspec
were still pinning Activity at 1.10.1.2 (net9) / 1.10.1.3 (net10) /
1.9.0.4 (net9 nuspec group), which triggered NU1605 package-downgrade
errors when restoring downstream templates such as uno53net9blank.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
(cherry picked from commit 920057d)
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) <noreply@anthropic.com>
(cherry picked from commit 162b1c3)
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) <noreply@anthropic.com>
(cherry picked from commit 9dd0c93)
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) <noreply@anthropic.com>
(cherry picked from commit e2d0370)
@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 platform/android 🤖 Categorizes an issue or PR as relevant to the Android platform area/skia ✏️ Categorizes an issue or PR as relevant to Skia area/build Categorizes an issue or PR as relevant to build infrastructure area/automation Categorizes an issue or PR as relevant to project automation kind/documentation area/sdk Categorizes an issue or PR as relevant to the Uno.Sdk labels May 13, 2026
@mergify mergify Bot mentioned this pull request May 13, 2026
5 tasks
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.

3 participants