Context: https://github.com/xamarin/AndroidX/issues/916
`api-diff` currently fails for `Xamarin.AndroidX.Car.App.App` `1.4.0` which is preventing us from updating it. The nature of this crash is documented in https://github.com/xamarin/AndroidX/issues/916.
We have chosen not to spend the resources at this time to fix this tooling error. Instead, we are going to go ahead and update `Xamarin.AndroidX.Car.App.App` to version `1.4.0` and are going to exclude it from running `api-diff`.
Fixes: https://github.com/xamarin/GooglePlayServicesComponents/issues/880
If you try to consume the package `Xamarin.AndroidX.DataStore.Preferences`, you get the following error:
```
JAVA0000: Error in C:\.tools\.nuget\packages\xamarin.androidx.datastore.core.jvm\1.1.1.2\buildTransitive\net8.0-android34.0\..\..\jar\androidx.datastore.datastore-core-jvm.jar:androidx/datastore/core/Actual_jvmKt.class:
JAVA0000: Type androidx.datastore.core.Actual_jvmKt is defined multiple times:
- C:\.tools\.nuget\packages\xamarin.androidx.datastore.core.jvm\1.1.1.2\buildTransitive\net8.0-android34.0\..\..\jar\androidx.datastore.datastore-core-jvm.jar:androidx/datastore/core/Actual_jvmKt.class,
- obj\Release\net8.0-android\lp\30\jl\classes.jar:androidx/datastore/core/Actual_jvmKt.class
```
This is because through the complex set of dependencies, you end up using these 2 packages:
- `Xamarin.AndroidX.DataStore.Core.Android`
- `Xamarin.AndroidX.DataStore.Core.Jvm`
These packages contain the same Java code, the `Android` one seems to be a superset of the `Jvm` one:
![image](https://github.com/xamarin/AndroidX/assets/179295/cf40d9e5-bc26-4811-bbb9-793b28e4d83b)
Thus we believe the solution is to redirect the `Jvm` package to the `Android` one. That is, anytime the `Jvm` package is requested we are going to give it the `Android` one instead.
We will accomplish this via:
- Adding `Xamarin.AndroidX.DataStore.Core.Android` as a dependency of `Xamarin.AndroidX.DataStore.Core.Jvm`. This means anytime `Jvm` is requested `Android` will also be added.
- Removing the `Jvm` Java library and its bindings from `Xamarin.AndroidX.DataStore.Core.Jvm` so that it will no longer duplicate the bindings and Java library in `Android`.
With these changes, we no longer see the conflict errors when consuming the `Xamarin.AndroidX.DataStore.Preferences*` packages in the `ExtendedTests` suite.
Additionally, bump all the `androidx.datastore` packages so that this new version will get picked up.
Context: https://github.com/xamarin/AndroidX/pull/863
Fixes: https://github.com/dotnet/android/issues/9049
Fixes: https://github.com/xamarin/AndroidX/issues/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.