forked from dotnet/android
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Xamarin.Android.Build.Tasks] use aapt2 option to generate proguard r…
…ules Context: https://developer.android.com/studio/build/shrink-code#configuration-files Fixes: http://work.azdo.io/825420 Fixes: dotnet#3636 Let's say you used the following code fragment in an Android layout: <android.support.v7.widget.Toolbar /> Currently, you would need to add a ProGuard rule regardless if you were using ProGuard or R8. Fortunately, `aapt2` has a command-line switch: > aapt2 link -h ... --proguard arg Output file for generated Proguard rules. According to the Google docs for R8: AAPT2 generates keep rules based on references to classes in your app’s manifest, layouts, and other app resources. For example, AAPT2 includes a keep rule for each Activity that you register in your app’s manifest as an entry point. I added a new `ProguardRuleOutput` property for `<Aapt2Link/>` and set it in cases where `$(AndroidLinkTool)` is not blank. I added this file to `@(ProguardConfiguration)`, so it will get picked up by ProGuard or R8. I updated an existing test for this scenario, checking that a type is generated in the rules and exists in the final `classes.dex` file.
- Loading branch information
1 parent
1a61fa8
commit 78d95de
Showing
3 changed files
with
18 additions
and
1 deletion.
There are no files selected for viewing
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
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
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