-
Notifications
You must be signed in to change notification settings - Fork 50
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
Upgrading Xamarin.AndroidX.Lifecycle packages to version 2.6.1 makes the build fail for duplicated classes #717
Comments
Thanks for reporting. Do you have repro sample or at least |
I'm seeing the same <PackageReference Include="Microsoft.AppCenter.Analytics" Version="5.0.1" />
<PackageReference Include="Microsoft.AppCenter.Crashes" Version="5.0.1" />
<PackageReference Include="Microsoft.AppCenter.Distribute" Version="5.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="MvvmCross" Version="8.0.2" />
<PackageReference Include="MvvmCross.DroidX.Material" Version="8.0.2" />
<PackageReference Include="MvvmCross.DroidX.RecyclerView" Version="8.0.2" />
<PackageReference Include="MvvmCross.Plugin.Messenger" Version="8.0.2" />
<PackageReference Include="MvvmCross.Plugin.ResxLocalization" Version="8.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Serilog" Version="2.12.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="3.1.0" />
<PackageReference Include="Serilog.Formatting.Compact" Version="1.1.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Serilog.Sinks.Xamarin" Version="1.0.0" />
<PackageReference Include="sqlite-net-pcl" Version="1.8.116" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="Xamarin.AndroidX.Core.SplashScreen" Version="1.0.0.3" />
<PackageReference Include="Xamarin.AndroidX.Preference" Version="1.2.0.4" />
<PackageReference Include="Xamarin.AndroidX.Work.Runtime" Version="2.7.1.6" />
<PackageReference Include="Xamarin.AndroidX.ConstraintLayout" Version="2.1.4.3" />
<PackageReference Include="Xamarin.AndroidX.CardView" Version="1.0.0.18" />
<PackageReference Include="Xamarin.Essentials" Version="1.7.5" />
<PackageReference Include="Xamarin.Firebase.Messaging" Version="123.1.1.1" />
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.8.0" />
<PackageReference Include="Xamarin.Google.Dagger" Version="2.44.2.1" />
<PackageReference Include="Xamarin.GooglePlayServices.Location" Version="120.0.0.1" />
<PackageReference Include="Xamarin.GooglePlayServices.Maps" Version="118.1.0.1" />
<PackageReference Include="Xamarin.Kotlin.StdLib.Jdk8" Version="1.8.10" />
<PackageReference Include="ZXing.Net.Mobile" Version="3.1.0-beta2" /> |
I'm sorry for the late answer. I don't have a repro sample, but I can share the PackageReferences below: <ItemGroup>
<PackageReference Include="Microsoft.AppCenter.Analytics">
<Version>5.0.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.AppCenter.Crashes">
<Version>5.0.1</Version>
</PackageReference>
<PackageReference Include="NLog">
<Version>5.1.3</Version>
</PackageReference>
<PackageReference Include="Polly">
<Version>7.2.3</Version>
</PackageReference>
<PackageReference Include="Syncfusion.Licensing">
<Version>21.1.38</Version>
</PackageReference>
<PackageReference Include="Syncfusion.Xamarin.SfAutoComplete.Android">
<Version>21.1.38</Version>
</PackageReference>
<PackageReference Include="Syncfusion.Xamarin.SfRotator.Android">
<Version>21.1.38</Version>
</PackageReference>
<PackageReference Include="Syncfusion.Xamarin.SfSchedule.Android">
<Version>21.1.38</Version>
</PackageReference>
<PackageReference Include="Syncfusion.Xamarin.SfTreeView.Android">
<Version>21.1.38</Version>
</PackageReference>
<PackageReference Include="Xamarin.Android.Support.v7.RecyclerView">
<Version>28.0.0.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.AppCompat">
<Version>1.6.0.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Fragment">
<Version>1.5.5.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Legacy.Support.Core.UI">
<Version>1.0.0.17</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData">
<Version>2.5.1.2</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Migration">
<Version>1.0.10</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Navigation.Fragment">
<Version>2.5.3.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Navigation.Runtime">
<Version>2.5.3.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Navigation.UI">
<Version>2.5.3.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Startup.StartupRuntime">
<Version>1.1.1.4</Version>
</PackageReference>
<PackageReference Include="Xamarin.Essentials" Version="1.7.5" />
<PackageReference Include="Xamarin.Google.Android.DataTransport.TransportBackendCct">
<Version>3.1.8.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.Google.Android.DataTransport.TransportRuntime">
<Version>3.1.8.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.Google.Android.Material">
<Version>1.8.0</Version>
</PackageReference>
<PackageReference Include="Realm">
<Version>10.21.0</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>13.0.3</Version>
</PackageReference>
<PackageReference Include="Xamarin.Firebase.Messaging">
<Version>123.1.1.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.Google.Dagger">
<Version>2.44.2.1</Version>
</PackageReference>
<PackageReference Include="Xamarin.GooglePlayServices.Base">
<Version>118.1.0.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.Identity.Client">
<Version>4.52.0</Version>
</PackageReference>
</ItemGroup>
Do you think this is enough? What also is needed? |
It is OK. Thanks
I hope so. Usually it is versions mismatch of the transitive dependencies. |
possibly related |
Workaround to test |
The workaround didn't help. I've also tried explicitly referencing the latest Xamarin.AndroidX.Lifecycle (Common, Common.Java8, Extensions) packages with no success. |
The full error:
|
This is big problem:
Android support libraries are not supported anymore. |
Mmm this could be a great issue. I think this package could be needed for the Syncfusion Treeview. I will try tomorrow to remove it and see if everything works out. |
I'm not telling this is the root cause, but Android Support causes issues with modern apps which use AndroidX.
Could be. Try updating Treeview. Though I think you should not need to add some dependency for Treeview manually. Or try removing
Great. |
Same here. Visual Studio for Mac 17.5.3 (build 15), MAUI net7.0 app.
Package reference list:
It's a fresh project so I wasn't updating Directory 'obj/Debug/net7.0-android/lp/173' is from 'androidx.lifecycle.lifecycle-runtime-ktx.aar' (double-checked it with map.cache). |
The problem can be easily reproduced by simply adding these two dependencies:
|
@moljac
Strange thing though is that .NET Android application compiled and ran just fine with the same packages that were causing build failure for MAUI app. |
This is usually how I do it, but it is not ideal, as you probably found out. I need to find a way to detect issue easier and even to suggest or implement fix. |
by .NET Android do you mean Xamarin classic? Can you provide csproj? |
That might be a bit complicated. The whole solution is MAUI class library based on native Android (and iOS) bindings. Bindings are then wrapped in platform-specific class libraries, and these libraries are used as dependencies in a single MAUI class library. I was testing Android class library with both .NET Android app and MAUI app, and for MAUI it didn't work as expected. Android library csproj:
Android app csproj:
MAUI app currently uses multiplatform library, so I believe its csproj is of no use to you, but I also tested it by adding nuget packages directly to the project the same way as I described here. Please let me know if you need more detail on it. |
I'm using .net 7 with the net7.0-android target and getting the same thing. |
This seems to work:
|
@moljac Yes, updating to the latest versions resolved the issue for me. Thanks! |
Everything is working well now after the recent NuGet package updates. Thanks for the help! These versions are working together now: <ItemGroup>
<PackageReference Include="Microsoft.AppCenter.Analytics" Version="5.0.1" />
<PackageReference Include="Microsoft.AppCenter.Crashes" Version="5.0.1" />
<PackageReference Include="Microsoft.AppCenter.Distribute" Version="5.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="MvvmCross" Version="8.0.2" />
<PackageReference Include="MvvmCross.DroidX.Material" Version="8.0.2" />
<PackageReference Include="MvvmCross.DroidX.RecyclerView" Version="8.0.2" />
<PackageReference Include="MvvmCross.Plugin.Messenger" Version="8.0.2" />
<PackageReference Include="MvvmCross.Plugin.ResxLocalization" Version="8.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Serilog" Version="2.12.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="3.1.0" />
<PackageReference Include="Serilog.Formatting.Compact" Version="1.1.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Serilog.Sinks.Xamarin" Version="1.0.0" />
<PackageReference Include="sqlite-net-pcl" Version="1.8.116" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="Xamarin.AndroidX.Core.SplashScreen" Version="1.0.0.4" />
<PackageReference Include="Xamarin.AndroidX.Preference" Version="1.2.0.5" />
<PackageReference Include="Xamarin.AndroidX.Work.Runtime" Version="2.8.1.1" />
<PackageReference Include="Xamarin.AndroidX.ConstraintLayout" Version="2.1.4.4" />
<PackageReference Include="Xamarin.AndroidX.CardView" Version="1.0.0.19" />
<PackageReference Include="Xamarin.Essentials" Version="1.7.5" />
<PackageReference Include="Xamarin.Firebase.Messaging" Version="123.1.1.1" />
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.8.0.1" />
<PackageReference Include="Xamarin.GooglePlayServices.Location" Version="120.0.0.1" />
<PackageReference Include="Xamarin.GooglePlayServices.Maps" Version="118.1.0.1" />
<PackageReference Include="ZXing.Net.Mobile" Version="3.1.0-beta2" />
</ItemGroup> |
@wfhm ??
There might be issues (slight probability) with GPS-FB-MLKit dependencies, but I am working on it. |
@moljac sorry for the delay. We had published nupkg with older dependency versions, but I’ve checked the new versions and it seems to be working fine. Thanks! |
It is OK. Just wanted to know.
You are welcome. |
Closing this issue |
Hi, |
Just update all dependencies to latest. Note: GPS-FB-MLKit or other 3rd party package might still cause issues. Namely GPS-FB-MLKit is not yet "aligned", so particular dependency could pull in problematic older packages and issue could be hit again.
It is not that easy. In some cases |
Thanks for your reply. |
I tried downgraded the the Xamarin.AndroidX.BioMetric and *.AndroidX.Core to the previous level (Biometric = 1.1.0.10 & Core = 1.8.0.1) then I can build the project successfully. Just for a report, since my project is approaching deadline, I cannot check more regarding this problem. |
* fix width of the set indicator fix persistance of the model when sets are updated migrate to .NET 8 * fix width of the set indicator fix persistance of the model when sets are updated migrate to .NET 8 * run on windows * package updates and using a flag * no framework flag * downgrade package due to dotnet/android-libraries#717 xamarin/GooglePlayServicesComponents#694
Duplicate |
Possible Workaround I had a similar problem, but with another packages. So, basically this thread helped to understand the root of the problem. Problem:
I went into the both paths
I performed a quick smoke test and looks like it work, but no guarantee yet. Maybe it'll help someone :) |
Thanks for the feedback.
Yes it is about transitive dependencies and what gets referenced + google moving types around.
It works on few other samples I am investigating. Still several to do.
It did. Thanks |
As temp workaround try explicitly adding following PackageReferences:
and yes - please report here if workaround works. |
In the process of porting a Xamarin native app (android and ios) to .NET MAUI. In the port of android, fixed all of the compilation errors only to hit this bug. Adding your explicit package references cleared up the error. Thanks! |
@tklempay Thanks for the feedback! |
Android application type
Classic Xamarin.Android (MonoAndroid12.0, etc.)
Affected platform version
Visual Studio 2022 Enterprise, Windows 11, Xamarin.Android, build tools Android 13
Description
Upgrading packages Xamarin.AndroidX.Lifecycle.Runtime from previous version to 2.6.1 causes a Java error:
This will happen also if the update is triggered by updating another NuGet packaged that have a dependecy on Lifecycle packages, like Xamarin.AndroidX.Fragment
Steps to Reproduce
Open solution NuGet packages, then upgrade Lifecycle related packages.
Did you find any workaround?
Just to not update the NuGet packges makes the solution work again.
Relevant log output
The text was updated successfully, but these errors were encountered: