AndroidX compatibility adjustments (backport #23097)#23259
Open
mergify[bot] wants to merge 13 commits into
Open
AndroidX compatibility adjustments (backport #23097)#23259mergify[bot] wants to merge 13 commits into
mergify[bot] wants to merge 13 commits into
Conversation
…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)
|
|
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.This is an automatic backport of pull request #23097 done by Mergify.