Closed mikelor closed 1 day ago
@moljac any ideas on this one?
I'd be happy to troubleshoot this, but unfortunately don't know too much about this aspect of Android.
Is there anything I can do to narrow the problem further? Or do I just regen all the libraries. Where to start?
@moljac any ideas on this one?
Usually explicit ProjectReference
s to latest package[s] help. but the problem is to find which packages. Mileage counts. I will take a look later.
I added PR to the sample
https://github.com/mikelor/AndroidX-Repro/pull/1
Sample:
Basically solution is to add latest packages (not all):
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0-android'">
<!--
new package created after MAUI release
-->
<PackageReference Include="Xamarin.AndroidX.Car.App.App" Version="1.4.0.4" />
<!--
explicit references to override MAUI used versions
-->
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="2.8.7.1" />
<PackageReference Include="Xamarin.AndroidX.Lifecycle.Runtime" Version="2.8.7.1" />
<PackageReference Include="Xamarin.AndroidX.Lifecycle.Runtime.Ktx" Version="2.8.7.1" />
<PackageReference Include="Xamarin.AndroidX.Lifecycle.Process" Version="2.8.7.1" />
<PackageReference Include="Xamarin.AndroidX.Lifecycle.ViewModel.Ktx" Version="2.8.7.1" />
<PackageReference Include="Xamarin.AndroidX.Collection.Jvm" Version="1.4.5.1" />
<PackageReference Include="Xamarin.AndroidX.Collection.Ktx" Version="1.4.5.1" />
<PackageReference Include="Xamarin.AndroidX.Activity" Version="1.9.3.1" />
<PackageReference Include="Xamarin.AndroidX.Activity.Ktx" Version="1.9.3.1" />
</ItemGroup>
Ok, so I analyzed the Maui9 project in this repo and these are the "warnings"
Xamarin.AndroidX.Lifecycle.LiveData 2.8.5.1 requires
Xamarin.AndroidX.Lifecycle.LiveData.Core (>= 2.8.5.1 && < 2.8.6)
Xamarin.AndroidX.Lifecycle.LiveData.Core 2.8.7.1 was resolved
Xamarin.AndroidX.Lifecycle.LiveData.Core.Ktx 2.8.5.1 requires
Xamarin.AndroidX.Lifecycle.LiveData.Core (>= 2.8.5.1 && < 2.8.6)
Xamarin.AndroidX.Lifecycle.LiveData.Core 2.8.7.1 was resolved
Xamarin.AndroidX.Collection.Ktx 1.4.3.1 requires
Xamarin.AndroidX.Collection.Jvm (>= 1.4.3.1 && < 1.4.4)
Xamarin.AndroidX.Collection.Jvm 1.4.5.1 was resolved.
Xamarin.AndroidX.Lifecycle.Runtime.Ktx 2.8.5.1 requires
Xamarin.AndroidX.Lifecycle.Runtime (>= 2.8.5.1 && < 2.8.6)
Xamarin.AndroidX.Lifecycle.Runtime 2.8.7.1 was resolved
Xamarin.AndroidX.Lifecycle.ViewModel.Ktx 2.8.5.1 requires
Xamarin.AndroidX.Lifecycle.ViewModel (>= 2.8.5.1 && < 2.8.6)
Xamarin.AndroidX.Lifecycle.ViewModel 2.8.7.1 was resolved.
Xamarin.AndroidX.Activity.Ktx 1.9.2.1 requires
Xamarin.AndroidX.Activity (>= 1.9.2.1 && < 1.9.3)
Xamarin.AndroidX.Activity 1.9.3.1 was resolved.
Xamarin.AndroidX.Lifecycle.Runtime.Ktx.Android 2.8.5.1 requires
Xamarin.AndroidX.Lifecycle.Runtime (>= 2.8.5.1 && < 2.8.6)
Xamarin.AndroidX.Lifecycle.Runtime 2.8.7.1 was resolved.
Xamarin.AndroidX.Lifecycle.Process 2.8.5.1
Xamarin.AndroidX.Lifecycle.Runtime (>= 2.8.5.1 && < 2.8.6)
Xamarin.AndroidX.Lifecycle.Runtime 2.8.7.1 was resolved
In the issue-1044 branch of the repo, I included the following references.
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0-android'">
<PackageReference Include="Xamarin.AndroidX.Car.App.App" Version="1.4.0.4" />
<!-- Trying to Resolve https://github.com/dotnet/android-libraries/issues/1044 -->
<PackageReference Include="Xamarin.AndroidX.Activity" Version="1.9.2.1" />
<PackageReference Include="Xamarin.AndroidX.Collection.Jvm" Version="1.4.5.1" />
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData.Core" Version="2.8.5.1" />
<PackageReference Include="Xamarin.AndroidX.Lifecycle.Runtime" Version="2.8.5.1" />
<PackageReference Include="Xamarin.AndroidX.Lifecycle.ViewModel" Version="2.8.5.1" />
</ItemGroup>
Unfortunately, I ended up with the following error and warning
1>F:\source\AndroidX.Car\Maui9\Maui9.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Collection.Ktx 1.4.3.1 requires Xamarin.AndroidX.Collection.Jvm (>= 1.4.3.1 && < 1.4.4) but version Xamarin.AndroidX.Collection.Jvm 1.4.5.1 was resolved.
1>F:\source\AndroidX.Car\Maui9\Maui9.csproj : error NU1107: Version conflict detected for Xamarin.AndroidX.Lifecycle.Common. Install/reference Xamarin.AndroidX.Lifecycle.Common 2.8.7.1 directly to project Maui9 to resolve this issue.
1>F:\source\AndroidX.Car\Maui9\Maui9.csproj : error NU1107: Maui9 -> Xamarin.AndroidX.Car.App.App 1.4.0.4 -> Xamarin.AndroidX.Lifecycle.Common.Java8 2.8.7.1 -> Xamarin.AndroidX.Lifecycle.Common (>= 2.8.7.1 && < 2.8.8)
1>F:\source\AndroidX.Car\Maui9\Maui9.csproj : error NU1107: Maui9 -> Xamarin.AndroidX.Lifecycle.Runtime 2.8.5.1 -> Xamarin.AndroidX.Lifecycle.Common (>= 2.8.5.1 && < 2.8.6).
In looking at the latest config.json in the repo, all of the 2.8.7.1 versions are specified. Is the problem I'm having due to the version of Android-Libraries that MAUI 9 / .NET9 uses? If so, how do I find out what version of "Xamarin.AndroicX.Car.App.App" to use?
Oops, I just saw your message. I'll try that. Thank You.
Hey @moljac your PR worked. Thank you for the quick fix. This should help me in the future if I run into this again Closing!
Hey @moljac your PR worked. Thank you for the quick fix. This should help me in the future if I run into this again Closing!
Great that I could help. Remember: it might [will] happen again, but the workaround is to add explicit dependencies. We work on [re]solution, but it is not trivial.
Android framework version
net9.0-android
Affected platform version
9.0.100
Description
I'm upgrading my Android Auto sample application Chaaos from .NET8 to .NET9. I'm including the latest Xamarin.AndroidX.Car.App.App (1.4.0.4) package. When building I get the following Warnings.
The main branch has the .NET8 version, and the dotnet9 branch contains the updated version. Also see a simple MAUI app in the following section that illustrates this issue.
Steps to Reproduce
I have created a repro basic MAUI App. See AndroidX-Repro. There is a Maui8 project and a Maui9 project. You can see that the MAUI8 project does not generate the Warnings, where the Maui9 project does.
Also Note that the Maui8 version has a fix for #18665
Did you find any workaround?
Not at the moment.
Relevant log output