[Xamarin.Android.Build.Tasks] fix duplicate .aar
files
#8196
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context: dotnet/maui#16024 (comment)
.NET MAUI's build currently fails with:
What is very wrong about this, it is trying to
aapt2 compile
a*.stamp
file:Normally this runs against
*.flat
or*.flata
files.This problem was introduced in 26ffd5d:
Library A uses an AndroidX package, the AndroidX
.aar
file is added to@(AndroidAarLibrary)
. The NuGet package does this in a.targets
file.With the change in 26ffd5d, the
.aar
is copied to Library A's build output.Library B uses the same AndroidX package and references Library A.
Library B now has duplicate
.aar
files & has the weird build error!I could reproduce the issue in a test.
There may be a second bug here, but we should update our logic to be:
So we now only copy:
The new
@(AndroidLibrary)
item group with an.aar
extension. Not@(AndroidAarLibrary)
.Any
@(LibraryProjectZip)
that are not in@(AndroidLibrary)
. This supports the classic item group name, keeping our behavior before.Now the new test and the test updated in 26ffd5d both pass.