[Xamarin.Android.Build.Tasks] Thrown an exception while enabling "AndroidUseAapt2" in application. #3218
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.
Fixes #3123
Commit 373c6ed added a new
_ConvertCustomView
target tohandle the conversion of custom view to the md5 hash versions.
While it worked most of the time, there was a very specific
area where it was not fixing up the custom views.
This problem only occurs when a library project code is updated.
When happens next is when the main app builds the library
resources are then re-extracted to the
$(IntermediateOutputPath)lp\XX\ji\res
directory. TheConvertResorucesCases
task is then run to fixup thoseres
files with the correct casing. After than
GenerateJavaStubs
is then also run, this is because the library project was
updated.
However at this point the wheels fall of the wagon because
_ConvertCustomViews
does NOT run. this is because itis only using the following inputs.
Neither of these files are updated in this instance. The
acwmap file will only be updated if a class or namespace
are changed. If code within a class is changed nothing the
the acwmap will need to be updated, so we don't update the
file.
The
$(_CustomViewMapFile)
also does not be updated unlessresources are added or removed. So that doesn't change either.
The result is the target is skipped, and we end up with a
custom view which does NOT have the correct md5 hash. This
results in the following error at runtime.
The fix in this case is to update the Inputs of the
_ConvertCustomView
target to have the following
By including these two extra items we can make sure the target
runs if either an app resource is updated or if a library
project is updated.
A unit test has been updated to test for this particular issue.