-
Notifications
You must be signed in to change notification settings - Fork 533
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
[Xamarin.Android.Build.Tasks] Fix aapt_rules.txt corruption #7587
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dellis1972
force-pushed
the
Issue7447
branch
2 times, most recently
from
December 1, 2022 14:20
58b0278
to
4623e8a
Compare
jonpryor
reviewed
Dec 2, 2022
jonpryor
reviewed
Dec 2, 2022
Fixes dotnet#7447 Users are reporting a error with the aapt_rules file generated by aapt2 ``` MSBUILD : java.exe error JAVA0000: Error in obj\Release\110\aapt_rules.txt at line 289, column 1: [C:\Jenkins\workspace\Demo\Demo.Android\Demo.Android.csproj] MSBUILD : java.exe error JAVA0000: Expected char '-' at obj\Release\110\aapt_rules.txt:289:1 [C:\Jenkins\workspace\Demo\Demo.Android\Demo.Android.csproj] MSBUILD : java.exe error JAVA0000: nit>(...); } [C:\Jenkins\workspace\Demo\Demo.Android\Demo.Android.csproj] MSBUILD : java.exe error JAVA0000: Compilation failed ``` This only happens when building with `AndroidCreatePackagePerAbi` set to `true`. After looking at the code, it turns out that we call `aapt2 link` multiple times when building per abi. The temp file used for the `aapt2 link` proguard output was the same file for ALL of the calls. This results in one call to aapt2 overwriting the previous ones results... or worse leaving garbage at the end. So the fix in this case is to provide a different temp file for each call to `aapt2`. These files are then combined later just in case they contain unique information for that abi. While this does result in duplicate lines in the `aapt_rules` file, this does not impact on the build.
grendello
added a commit
to grendello/xamarin-android
that referenced
this pull request
Jan 4, 2023
* main: [Xamarin.Android.Build.Tasks] use %(TrimmerRootAssembly.RootMode) All (dotnet#7651) Bump to dotnet/installer@47a747f 8.0.100-alpha.1.22616.7 (dotnet#7647) Bump to dotnet/installer@167a4ed 8.0.100-alpha.1.22611.1 (dotnet#7630) Bump to xamarin/Java.Interop/main@f8d77fa (dotnet#7638) [ci] Fix Designer test paths (dotnet#7635) [Xamarin.Android.Build.Tasks] perf improvements for LlvmIrGenerator (dotnet#7626) [Xamarin.Android.Build.Tasks] AutoImport `*.webp` files (dotnet#7601) Localized file check-in by OneLocBuild Task (dotnet#7632) Bump $(ProductVersion) to 13.2.99 Bump to xamarin/monodroid@c0c933b7 (dotnet#7633) [Xamarin.Android.Build.Tasks] Fix aapt_rules.txt corruption (dotnet#7587) [Xamarin.Android.Build.Tasks] Add XA1031 error (dotnet#7448) Bump to xamarin/Java.Interop/main@149d70f (dotnet#7625) [CODEOWNERS] More updates to CODEOWNERS (dotnet#7628) [Xamarin.Android.Build.Tasks] avoid `File.Exists()` check (dotnet#7621)
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 #7447
Users are reporting a error with the aapt_rules file generated by aapt2
This only happens when building with
AndroidCreatePackagePerAbi
set totrue
. After looking at the code, it turns out that we callaapt2 link
multiple times when building per abi. The temp file used for theaapt2 link
proguard output was the same file for ALL of the calls. This results in one call to aapt2 overwriting the previous ones results... or worse leaving garbage at the end.So the fix in this case is to provide a different temp file for each call to
aapt2
. These files are then combined later just in case they contain unique information for that abi. While this does result in duplicate lines in theaapt_rules
file, this does not impact on the build.