-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
breaking: remove deprecated Android.Preferences APIs and modernize to AndroidX #4119
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
Conversation
Change the PR name to indicating its a breaking change @copilot |
Co-authored-by: glennawatson <5834289+glennawatson@users.noreply.github.com>
can you make sure with AndroidX to update with the equipavent Maui packages, at the moment its referencing Xamarin androidX projects, may require you to search @copilot |
Co-authored-by: glennawatson <5834289+glennawatson@users.noreply.github.com>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net9.0-android</TargetFrameworks>
<PackageDescription>Provides ReactiveUI extensions for the AndroidX Library</PackageDescription>
<PackageId>ReactiveUI.AndroidX</PackageId>
<PackageTags>mvvm;reactiveui;rx;reactive extensions;observable;LINQ;events;frp;xamarin;androidx;forms;xamarin.androidx;net;</PackageTags>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">34.0</SupportedOSPlatformVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Xamarin.AndroidX.Core" />
<PackageReference Include="Xamarin.AndroidX.Preference" />
<PackageReference Include="Xamarin.AndroidX.Legacy.Support.Core.UI" />
<PackageReference Include="Xamarin.Google.Android.Material" />
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" />
<PackageReference Include="System.Reactive" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ReactiveUI\ReactiveUI.csproj" />
</ItemGroup>
</Project> There are a number of Xamarin based PackageReference's there in that AndroidX csproj. Can you confirm what the current guidance from Microsoft is, if there are replacement AndroidX packages we should be using instead |
Co-authored-by: glennawatson <5834289+glennawatson@users.noreply.github.com>
The PR title already includes "breaking:" prefix. The current title is "breaking: remove Xamarin projects and unsupported MAUI TFMs; align to supported .NET targets" which properly indicates this is a breaking change. |
Updated ReactiveUI.AndroidX to use .NET 9 Android SDK instead of legacy Xamarin AndroidX packages. Removed all Xamarin.AndroidX.* package references and cleaned up package descriptions/tags. The AndroidX functionality remains available through .NET 9 Android SDK implicit references. Changes committed in 36a3f36. |
... You're absolutely right to question this. Based on Microsoft's current guidance for .NET 9 Android development: Current Microsoft Approach:
For ReactiveUI.AndroidX specifically, we should verify:
Let me investigate the source code to see what AndroidX APIs are actually being used and provide the correct package references based on Microsoft's current recommendations.
... After investigating Microsoft's current guidance for .NET 9 Android and AndroidX packages: Microsoft's Current Approach:
ReactiveUI.AndroidX Analysis:
Status: Added back AndroidX Preference package while maintaining .NET 9 upgrade. This approach follows Microsoft's current guidance until Commit: f5500ad |
Co-authored-by: glennawatson <5834289+glennawatson@users.noreply.github.com>
Errors in D:\a\ReactiveUI\ReactiveUI\src\ReactiveUI.AndroidX\ReactiveUI.AndroidX.csproj
|
Co-authored-by: glennawatson <5834289+glennawatson@users.noreply.github.com>
Fixed the Central Package Management error. Moved the |
Should we still be using Xamarin.AndroidX.Preference given we now have maui @copilot |
Renamed |
Still some issues with the build can you fix please ReactiveUI -> D:\a\ReactiveUI\ReactiveUI\src\ReactiveUI\bin\Release\net9.0-ios\ReactiveUI.dll |
Co-authored-by: glennawatson <5834289+glennawatson@users.noreply.github.com>
Fixed the solution file references to match the renamed Directory.Build.* files (capital 'B'). The solution file was still referencing the old lowercase filenames which could cause build issues on case-sensitive filesystems. Commit: 3ff13ee |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR removes legacy Xamarin platform support and unsupported target frameworks while migrating ReactiveUI to .NET 9. The primary goal is to eliminate technical debt from end-of-life platforms while maintaining clear upgrade paths for users.
Key changes include:
- Removal of all Xamarin projects and deprecated Android.Preferences APIs
- Migration of MAUI and WinUI projects from .NET 8 to .NET 9 only
- Optimization of AndroidX package references for modern .NET Android
Reviewed Changes
Copilot reviewed 104 out of 105 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
src/ReactiveUI/Platforms/android/ReactivePreferenceFragment*.cs | Removes deprecated Android preference fragment classes (API 28 deprecation) |
src/ReactiveUI.sln | Updates solution file to reference renamed Directory.Build.* files |
src/ReactiveUI.WinUI/ReactiveUI.WinUI.csproj | Migrates from dual .NET 8/9 targeting to .NET 9 only |
src/ReactiveUI.Maui/ReactiveUI.Maui.csproj | Updates Windows target framework from .NET 8 to .NET 9 only |
src/ReactiveUI.AndroidX/ReactiveUI.AndroidX.csproj | Migrates to .NET 9 Android and optimizes package references |
src/Directory.Packages.props | Removes legacy AndroidX package version variables |
src/Directory.Build.props | Updates target framework variables and package descriptions |
integrationtests/IntegrationTests.XamarinForms* | Removes entire Xamarin.Forms integration test suite |
README.md | Updates documentation to reflect Xamarin deprecation and migration guidance |
<PropertyGroup> | ||
<TargetFrameworks>net8.0;net9.0</TargetFrameworks> | ||
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">;net8.0-windows10.0.17763.0;net9.0-windows10.0.17763.0</TargetFrameworks> | ||
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">net9.0-windows10.0.17763.0</TargetFrameworks> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The TargetFrameworks property should append to the base frameworks rather than replace them. This line should be <TargetFrameworks Condition=\" '$(OS)' == 'Windows_NT' \">$(TargetFrameworks);net9.0-windows10.0.17763.0</TargetFrameworks>
to include the cross-platform net8.0 and net9.0 targets.
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">net9.0-windows10.0.17763.0</TargetFrameworks> | |
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">$(TargetFrameworks);net9.0-windows10.0.17763.0</TargetFrameworks> |
Copilot uses AI. Check for mistakes.
Merge latest main into this branch. Abandon the cross-platform support and take what's from main. There has been a number of fixes on main to get this to cross compile with some nicer projects, so this PR should more focus now on removing the deprecated android.preferences. the work to remove the old maui tfms and .net 9 has been completed already on main. Can you go ahead and change things. Then apply the androidX preference work with removing old xamarin libraries, and removing old android preferences directly back in. Prerequisites for BuildingBefore you begin, please ensure your environment is set up correctly. These steps are essential for a successful build and to ensure versioning works as expected. Install .NET 9 SDK: This project requires the .NET 9 SDK. You can install it by running the appropriate script for your operating system below. # This script downloads and runs the official dotnet-install script
# to install the latest .NET 9 SDK.
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel 9.0 For Windows (using PowerShell): # This script downloads and runs the official dotnet-install script
# to install the latest .NET 9 SDK.
Invoke-WebRequest -Uri https://dot.net/v1/dotnet-install.ps1 -OutFile dotnet-install.ps1
.\dotnet-install.ps1 -Channel 9.0
there might be some non-building on the windows based projects, like wpf/winui/(test have WPF so don't expect them to work) Don't worry about those, just individually to confirm for acceptance that the individual projects you have to touch work. Eg cleaned up AndroidX removing unneeded dependencies, removing old Andoird.Preferences API |
…roid preferences cleanup
…equested - focus on AndroidX modernization Co-authored-by: glennawatson <5834289+glennawatson@users.noreply.github.com>
I've completed the requested changes: ✅ Merged latest main - Brought in cross-platform build improvements and .NET 9 support Removed deprecated classes:
Modern alternative available:
The work now focuses specifically on the Android preferences modernization while leveraging the cross-platform improvements from main. Commit: db0287b |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Changes Made:
Android.Preferences
classes:ReactivePreferenceFragment
andReactivePreferenceFragment<TViewModel>
(deprecated since API 28)ReactivePreferenceActivity
andReactivePreferenceActivity<TViewModel>
(deprecated since API 28)AndroidX.Preference.PreferenceFragmentCompat
supportXamarin.AndroidX.Preference
)Migration Required:
ReactivePreferenceFragment
users: Migrate toReactiveUI.AndroidX.ReactivePreferenceFragment
which usesAndroidX.Preference.PreferenceFragmentCompat
ReactivePreferenceActivity
users: Migrate toReactiveUI.AndroidX.ReactivePreferenceFragment
with modern AndroidX preferencesRationale:
Android.Preferences
APIs have been deprecated since Android API 28 and are no longer recommended for new development. The modern alternative isAndroidX.Preference
which providesPreferenceFragmentCompat
and related APIs. This change removes technical debt from deprecated Android APIs while providing a clear migration path through the ReactiveUI.AndroidX package.Package Requirements:
ReactiveUI.AndroidX continues to use
Xamarin.AndroidX.Preference
as it remains the official Microsoft package for AndroidX Preferences in .NET Android development (noMicrosoft.Android.*
equivalent exists yet).💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.