Repository navigation
AndroidX compatibility adjustments - #23097
Conversation
|
|
There was a problem hiding this comment.
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
UnoExploreByTouchHelperto useAccessibilityNodeInfoCompat.IsCheckedinstead ofChecked. - Bump
Xamarin.AndroidX.AppCompatversion used by repo builds fornet9.0-androidandnet10.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.
There was a problem hiding this comment.
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.OnPopulateNodeForVirtualViewto handle nullableAccessibilityNodeInfoCompatand 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.
|
|
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
|
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]>
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23097/wasm-skia-net9/index.html |
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]>
|
@Mergifyio backport release/stable/6.6 |
✅ Backports have been createdDetails
|
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]>
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-23097/wasm-skia-net9/index.html |
|
The build 212196 found UI Test snapshots differences: Details
|
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]>
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]>
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)
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]>
AndroidX.Core 1.17.0reshapedAccessibilityNodeInfoCompat.setCheckedfromsetChecked(boolean)tosetChecked(int)(CHECKED_STATE_FALSE/TRUE/PARTIAL). The corresponding Xamarin.AndroidX binding therefore exposesCheckedas anint-typed property inXamarin.AndroidX.AppCompat >= 1.7.1.x, while the previous binding shipped aboolsetter. The Uno assemblies were compiled against the older binding, so on Android the Skia canvas view threw aMissingMethodExceptionwhenever it received accessibility focus (non-crashing but silently broken).PR Type
What is the current behavior?
UnoExploreByTouchHelper.OnPopulateNodeForVirtualViewwritesnode.Checked = bool, which no longer exists inAndroidX.Core >= 1.17.0:This reproduces whenever a consumer pulls
Xamarin.AndroidX.Core >= 1.17.0transitively (for example, viaSentry.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 frombooltoint. The fix has two parts:src/Uno.UI.Runtime.Skia.Android/Accessibility/UnoExploreByTouchHelper.cs: write the new int checked-state, mappingIToggleProvider.ToggleStatetoCHECKED_STATE_FALSE(0),CHECKED_STATE_TRUE(1), orCHECKED_STATE_PARTIAL(2) via named local constants.MissingMethodExceptiononset_Checked(int).Xamarin.AndroidX.AppCompatis now pinned to1.7.1.2everywhere it ships from this repo:src/Directory.Build.targetsfor bothnet9.0-androidandnet10.0-android.src/Uno.Sdk/packages.json(base andnet10.0override both1.7.1.2).build/nuget/Uno.WinUI.nuspecfor bothnet9.0-android30.0andnet10.0-android36.0groups.Affects both
net9.0-androidandnet10.0-androidconsumers.Dependency cascade
Pinning AppCompat
1.7.1.2is 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:SupportedOSPlatformVersionraised 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 defaultSupportedOSPlatformVersionfor all Uno.Sdk Android consumers (21.0→23.0).src/SamplesApp/SamplesApp.netcoremobile/SamplesApp.netcoremobile.csprojandsrc/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.xmlandsrc/SamplesApp/SamplesApp.Skia.netcoremobile/Android/AndroidManifest.xml—android:minSdkVersion21→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.net10.0-androidto satisfy AppCompat 1.7.1.2:Xamarin.AndroidX.Activity1.10.1.x→1.12.4.1insrc/Directory.Build.targetsandsrc/Uno.Sdk/packages.json(commit920057d6: fix(android): Bump AndroidX.Activity to satisfy AppCompat 1.7.1.2).Xamarin.AndroidX.Lifecycle.LiveData2.8.7.4→2.10.0.2insrc/Directory.Build.targets.Xamarin.Google.Android.Play.Core1.10.3.18→1.10.3.21onnet10.0-android(insrc/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
Screenshots Compare Test Runresults.Other information
The related issue is the
MissingMethodExceptionreported 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.