Repository navigation
[net7-rc2] Building an app in Release configuration reports incorrect duplicate types #7473
Description
Activity
- addedArea: App+Library BuildIssues when building Library projects or Application projects.Issues when building Library projects or Application projects.needs-triageIssues that need to be assigned.Issues that need to be assigned.
on Oct 20, 2022 Update: Building with
-p:RuntimeIdentifier=android-arm64makes the error go away, but only builds for one CPU architecture.- removedneeds-triageIssues that need to be assigned.Issues that need to be assigned.
on Oct 20, 2022 We probably need to add some additional logic to check for assemblies in the different runtime directories.
@dellis1972 would you know of a possible workaround for this (even if it means changing the targets files) ?
@jeromelaban the check is done within the Task GenerateJavaStubs. https://github.com/xamarin/xamarin-android/blob/main/src/Xamarin.Android.Build.Tasks/Tasks/GenerateJavaStubs.cs#L191
The problem is GenerateJavaStubs is getting ALL of the assemblies for each RuntimeIdentifier. So we end up with 4 entires for Uno.UI etc and others.
I guess you could write a target which runs just before the
_GenerateJavaStubstarget which will remove those duplicates from@(_ResolvedAssemblies)and@(_ResolvedUserMonoAndroidAssemblies).. but I'm not sure how that would effect the packaging as those same ItemGroups are used to package the final app. https://github.com/xamarin/xamarin-android/blob/main/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets#L1477You might be able to add a filter to that target locally and make copies of those ItemGroups which you then pass to
GenerateJavaStubs. (effectively replacing the@(_ResolvedAssemblies)and@(_ResolvedUserMonoAndroidAssemblies)for that target, but leaving those ItemGroups intack for the other targets.Reacted by Jérôme Laban- added a commit that references this issue
on Oct 20, 2022 - added 5 commits that reference this issue
on Nov 1, 2022 15 remaining items
- added a commit that references this issue
on Nov 22, 2022 @dellis1972 Any update on when this will be fixed. Currently the release build is broken when we target .net7 based workloads for android.
We have a fix (see #7477) just having issues getting the unit tests green so it can be merged.
Reacted by Roland Eckl- added a commit that references this issue
on Nov 28, 2022 - added a commit that references this issue
on Nov 29, 2022 🚀🚀 Thanks for the work on fixing this issue!
Reacted by Dean Ellis and Ben Askren- added a commit that references this issue
on Nov 30, 2022 @jonpryor Would you know when this update will be released? It does not seem to be part of an SR1 update (only iOS and macOS were updated, for what I could see). Thanks!
This fixed missed the cutoff date but should be in the next one.
The .NET 7 release branch is: https://github.com/xamarin/xamarin-android/tree/release/7.0.1xx
Reacted by Jérôme LabanObviously also not fixed in today's VS 17.4.4 release. :(
Fixed in 17.5 Preview 3!
You also should be able to run
dotnet workload update. This will also be in 17.5 GA.With updated workloads and Uno 4.7.37 it finally works even in VS17.4.4. I am able to publish targeting .net7 with AOT enabled. 😄
Reacted by Jérôme Laban and Thomas Labrecque- ghost locked as resolved and limited conversation to collaborators
on Mar 5, 2023
Android application type
Android for .NET (net6.0-android, etc.)
Affected platform version
net7.0-rc2
Description
Building a net6.0-android app in Release configuration causes the following errors:
then java-related errors:
Steps to Reproduce
dotnet new install Uno.ProjectTemplates.Dotnetdotnet new unoapp -o testappcd testapp\testapp.Mobiledotnet build -f net6.0-android -c ReleaseNotice a very large number of errors after the AOT step:
then java-related errors:
Did you find any workaround?
No, bumping to net7.0-android did not fix the issue. Considering the number of times the duplicate assembly is found, this would look like the number of target CPU architectures ?
Relevant log output
msbuild.zip