Skip to content

Add type forwards for AndroidX.Lifecycle* 2.8.* changes. #908

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

Merged
merged 1 commit into from
Jun 27, 2024
Merged

Conversation

jpobst
Copy link
Contributor

@jpobst jpobst commented Jun 21, 2024

Context: #863
Fixes: dotnet/android#9049
Fixes: #909

In version 2.8.*, Google moved all the types in 2 libraries into 2 new libraries:

  • Xamarin.AndroidX.Lifecycle.Common to Xamarin.AndroidX.Lifecycle.Common.Jvm.
  • Xamarin.AndroidX.Lifecycle.ViewModel to Xamarin.AndroidX.Lifecycle.ViewModel.Android.

While this is a source compatible change for users, it is not a binary compatible change for users that are relying on NuGets or assemblies that have not been recompiled.

These types may continue to work in Debug builds, but the linker and AOT compiler steps run for Release builds are unable to resolve the moved types, causing unfixable errors (other than recompiling all assemblies).

Adding [TypeForwardedToAttribute] attributes allows the linker and AOT to succeed without recompiling old assemblies.

@tuyen-vuduc
Copy link
Contributor

When do we have these changes rolled out? I really need it for my projects.

@MihaMarkic
Copy link

@tuyen-vuduc As a poor man's workaround - downgrade lifecycle libraries to 2.7.0, appcompat to 1.6.1 in android project, and similarly in .net project. It works then until this new fix is released.

@jpobst jpobst merged commit 1bd273c into main Jun 27, 2024
5 checks passed
@jpobst jpobst deleted the type-forwards branch June 27, 2024 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants