Skip to content

Commit d5363e8

Browse files
[Xamarin.Android.Build.Tasks] d8 and r8 support
Fixes: #1423 Fixes: #2040 ~~ Overview ~~ This enables d8 and r8 integration for Xamarin.Android. d8 is a "next-generation" dex compiler (over dx), and r8 is a replacement for proguard. For full details on the feature, see `Documentation/guides/D8andR8.md`. ~~ MSBuild targets changes ~~ New MSBuild properties include: - `$(AndroidDexGenerator)` - an enum-style property with options: `dx` and `d8`. Defaults to `dx`. - `$(AndroidLinkTool)` - an enum-style property, that can be left blank to disable code shrinking. Valid values are `proguard` and `r8`. Existing MSBuild properties still retain the old behavior: - `$(AndroidEnableProguard)` will set `$(AndroidLinkTool)` to `proguard`, although it is no longer used internally by Xamarin.Android targets. - `$(AndroidEnableDesugar)` will default to `true` if `d8` or `r8` are used. New MSBuild tasks include: - `<D8 />` - runs `d8.jar` with the required options for Xamarin.Android. - `<R8 />` - subclasses `<D8 />`, and adds functionality for multi-dex and code-shrinking. Additionally, any new MSBuild targets are placed in a new `Xamarin.Android.D8.targets` file. This is good first step to make `Xamarin.Android.Common.targets` smaller. Additionally: * `build.props` is now invalidated via the `$(AndroidDexGenerator)` and `$(AndroidLinkTool)` properties, instead of `$(AndroidEnableProguard)` * `build.props` is invalidated via `$(AndroidEnableDesugar)` ~~ Test changes ~~ Tests that need to validate various combinations of properties are now using parameters such as: [Values ("dx", "d8")] string dexGenerator, [Values ("", "proguard", "r8")] string linkTool Set on the `XamarinAndroidApplicationProject` such as: var proj = new XamarinAndroidApplicationProject { DexGenerator = dexGenerator, LinkTool = linkTool, }; In other cases, a simple `useD8` flag was added to set `DexGenerator="d8"`. Since adding test parameters, exponentially causes our test cases to expand, I removed some non-essential parameters: - `BuildProguardEnabledProject` dropped `useLatestSdk`, as it does not seem applicable here (and is deprecated). Otherwise would have 24 test cases... - `BuildApplicationWithSpacesInPath` dropped `isRelease` and defaulted it to `true`. We aren't going to likely encounter issues with spaces in a path that happen *only* in a `Debug` build. Otherwise we would have 24 test cases here... - `Desugar` dropped `enableDesugar` because it is certain this application project will not build *without* desugar. We don't need to test this, and would have 24 test cases otherwise... Also dropped some `[TestCaseSource]` attributes where the `[Values]` parameter was much cleaner. ~~ Changes to test/sample projects ~~ `HelloWorld` - `$(AndroidDexGenerator)` set to `d8` if unspecified. So we can track the performance benefit. `Xamarin.Forms Integration` - uses `d8` and `$(AndroidLinkTool)` set to `r8`, using a `proguard.cfg` file for Xamarin.Forms. Will help us track startup performance benefits of Java code shrinking and build performance. `Mono.Android-Tests` - uses `d8` and `$(AndroidLinkTool)` set to `r8`, to verify these on-device tests pass. `Runtime-MultiDex` - `$(AndroidDexGenerator)` set to `d8` if unspecified, to validate multi-dex is working properly with `d8`. ~~ Xamarin.Android build changes ~~ This adds https://r8.googlesource.com/r8 as a submodule in `external/r8`, and builds `d8.jar` and `r8.jar` via `src/r8/r8.csproj`. Currently using version 1.2.48 of r8. ~~ Deployment changes ~~ Three new files will need to be included in Xamarin.Android installers: - `d8.jar` - `r8.jar` - `Xamarin.Android.D8.targets` ~~ General changes ~~ * Fixed doc for `xa4304` error code * Added `xa4305` error code for `CompileToDalvik`, `R8`, and `CreateMultiDexMainDexClassList` * Removed log messages in `CreateMultiDexMainDexClassList` ~~ Performance Comparison ~~ | MSBuild Target | Options Enabled | Time | APK size (bytes) | dex size (bytes) | | --- | --- | ---: | ---: | ---: | | _CompileToDalvikWithDx | n/a | 11074ms | 13378157 | 3894720 | | _CompileToDalvikWithD8 | d8, (desugar enabled) | 8543ms | 13124205 | 3314064 | | _CompileToDalvikWithD8 | d8, (desugar disabled) | 9550ms | 13124205 | 3314064 | | _CompileToDalvikWithDx | multi-dex | 15632ms | 13390498 | 3916496 | | _CompileToDalvikWithD8 | d8, multi-dex | 25979ms | 13054626 | 3264096 | | _CompileToDalvikWithDx | proguard | 11903ms | 12804717 | 2446964 | | _CompileToDalvikWithD8 | d8, r8 | 13799ms | 12513901 | 1835588 | | _CompileToDalvikWithDx | multi-dex, proguard | 17279ms | 12804770 | 2449512 | | _CompileToDalvikWithD8 | d8, multi-dex, r8 | 13792ms | 12513954 | 1837588 | _NOTE: desugar is enabled by default with d8/r8_ I timed this builds with [this script][powershell_script], with a "Hello World" Xamarin.Forms app. Build logs here: [d8andr8.zip][d8andr8_zip] One can draw their own conclusions on which options are faster, better, smaller. See further detail in `D8andR8.md`. [powershell_script]: https://github.com/jonathanpeppers/HelloWorld/blob/39e2854f6ca39c0941fb8bd6f2a16d8b7663003e/build.ps1 [d8andr8_zip]: https://github.com/xamarin/xamarin-android/files/2470385/d8andr8.zip Co-authored-by: Atsushi Eno <[email protected]>
1 parent a9183e5 commit d5363e8

29 files changed

+1035
-176
lines changed

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@
3838
path = external/proguard
3939
url = https://github.com/xamarin/proguard.git
4040
branch = master
41+
[submodule "external/r8"]
42+
path = external/r8
43+
url = https://r8.googlesource.com/r8
44+
branch = d8-1.2
4145
[submodule "external/sqlite"]
4246
path = external/sqlite
4347
url = https://github.com/xamarin/sqlite.git

Documentation/guides/BuildProcess.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,23 @@ when packaing Release applications.
210210

211211
This property is `False` by default.
212212

213+
- **AndroidDexGenerator** &ndash; An enum-style property with valid
214+
values of `dx` or `d8`. Indicates which Android [dex][dex]
215+
compiler is used during the Xamarin.Android build process.
216+
Currently defaults to `dx`. For further information see our
217+
documentation on [D8 and R8][d8-r8].
218+
219+
[dex]: https://source.android.com/devices/tech/dalvik/dalvik-bytecode
220+
[d8-r8]: D8andR8.md
221+
222+
- **AndroidEnableDesugar** &ndash; A boolean property that
223+
determines if `desugar` is enabled. Android does not currently
224+
support all Java 8 features, and the default toolchain implements
225+
the new language features by performing bytecode transformations,
226+
called `desugar`, on the output of the `javac` compiler. Defaults
227+
to `False` if using `AndroidDexGenerator=dx` and defaults to
228+
`True` if using `AndroidDexGenerator=d8`.
229+
213230
- **AndroidEnableMultiDex** &ndash; A boolean property that
214231
determines whether or not multi-dex support will be used in the
215232
final `.apk`.
@@ -360,6 +377,14 @@ when packaing Release applications.
360377
<AndroidLinkSkip>Assembly1;Assembly2</AndroidLinkSkip>
361378
```
362379
380+
- **AndroidLinkTool** &ndash; An enum-style property with valid
381+
values of `proguard` or `r8`. Indicates which code shrinker is
382+
used for Java code. Currently defaults to an empty string, or
383+
`proguard` if `$(AndroidEnableProguard)` is `True`. For further
384+
information see our documentation on [D8 and R8][d8-r8].
385+
386+
[d8-r8]: D8andR8.md
387+
363388
- **LinkerDumpDependencies** &ndash; A bool property which enables
364389
generating of linker dependencies file. This file can be used as
365390
input for

Documentation/guides/D8andR8.md

Lines changed: 270 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,270 @@
1+
This is the D8 and R8 integration specification for Xamarin.Android.
2+
3+
# What is D8? What is R8?
4+
5+
At a high level, here are the steps that occur during an Android
6+
application's Java compilation:
7+
- `javac` compiles Java code
8+
- `desugar` remove's the "sugar" (from Java 8 features) that are not
9+
fully supported on Android
10+
- `proguard` shrinks compiled Java code
11+
- `dx` "dexes" compiled Java code into Android [dex][dex] format. This
12+
is an alternate Java bytecode format supported by the Android
13+
platform.
14+
15+
This process has a few issues, such as:
16+
- [proguard](https://www.guardsquare.com/en/products/proguard/manual)
17+
is made by a third party, and aimed for Java in general (not Android
18+
specific)
19+
- `dx` is slower than it _could_ be
20+
21+
So in 2017, Google announced a "next-generation" dex compiler named
22+
[D8](https://android-developers.googleblog.com/2017/08/next-generation-dex-compiler-now-in.html).
23+
24+
- D8 is a direct replacement for `dx`
25+
- R8 is a replacement for `proguard`, that also "dexes" at the same
26+
time. If using R8, a D8 call is not needed.
27+
28+
Both tools have support for various other Android-specifics:
29+
- Both `desugar` by default unless the `--no-desugaring` switch is
30+
specified
31+
- Both support [multidex][multidex]
32+
- R8 additionally has support to generate a default `multidex.keep`
33+
file, that `proguard` can generate
34+
35+
Additionally, R8 is geared to be backwards compatible to `proguard`.
36+
It uses the same file format for configuration and command-line
37+
parameters as `proguard`. However, at the time of writing this, there
38+
are still several flags/features not implemented in R8 yet.
39+
40+
For more information on how R8 compares to `proguard`, see a great
41+
article written by the `proguard` team
42+
[here](https://www.guardsquare.com/en/blog/proguard-and-r8).
43+
44+
You can find the source for D8 and R8
45+
[here](https://r8.googlesource.com/r8/).
46+
47+
For reference, `d8 --help`:
48+
```
49+
Usage: d8 [options] <input-files>
50+
where <input-files> are any combination of dex, class, zip, jar, or apk files
51+
and options are:
52+
--debug # Compile with debugging information (default).
53+
--release # Compile without debugging information.
54+
--output <file> # Output result in <outfile>.
55+
# <file> must be an existing directory or a zip file.
56+
--lib <file> # Add <file> as a library resource.
57+
--classpath <file> # Add <file> as a classpath resource.
58+
--min-api # Minimum Android API level compatibility
59+
--intermediate # Compile an intermediate result intended for later
60+
# merging.
61+
--file-per-class # Produce a separate dex file per input class
62+
--no-desugaring # Force disable desugaring.
63+
--main-dex-list <file> # List of classes to place in the primary dex file.
64+
--version # Print the version of d8.
65+
--help # Print this message.
66+
```
67+
68+
For reference, `r8 --help`:
69+
```
70+
Usage: r8 [options] <input-files>
71+
where <input-files> are any combination of dex, class, zip, jar, or apk files
72+
and options are:
73+
--release # Compile without debugging information (default).
74+
--debug # Compile with debugging information.
75+
--output <file> # Output result in <file>.
76+
# <file> must be an existing directory or a zip file.
77+
--lib <file> # Add <file> as a library resource.
78+
--min-api # Minimum Android API level compatibility.
79+
--pg-conf <file> # Proguard configuration <file>.
80+
--pg-map-output <file> # Output the resulting name and line mapping to <file>.
81+
--no-tree-shaking # Force disable tree shaking of unreachable classes.
82+
--no-minification # Force disable minification of names.
83+
--no-desugaring # Force disable desugaring.
84+
--main-dex-rules <file> # Proguard keep rules for classes to place in the
85+
# primary dex file.
86+
--main-dex-list <file> # List of classes to place in the primary dex file.
87+
--main-dex-list-output <file> # Output the full main-dex list in <file>.
88+
--version # Print the version of r8.
89+
--help # Print this message.
90+
```
91+
92+
# What did Xamarin.Android do *before* D8/R8?
93+
94+
In other words, what is currently happening *before* we introduce D8/R8 support?
95+
96+
1. The [Javac](https://github.com/xamarin/xamarin-android/blob/221a2190ebb3aaec9ecd9b1cf8f7f6174c43153a/src/Xamarin.Android.Build.Tasks/Tasks/Javac.cs)
97+
MSBuild task compiles `*.java` files to a `classes.zip` file.
98+
2. The [Desugar](https://github.com/xamarin/xamarin-android/blob/221a2190ebb3aaec9ecd9b1cf8f7f6174c43153a/src/Xamarin.Android.Build.Tasks/Tasks/Desugar.cs)
99+
MSBuild task "desugars" using `desugar_deploy.jar` if
100+
`$(AndroidEnableDesugar)` is `True`.
101+
3. The [Proguard](https://github.com/xamarin/xamarin-android/blob/221a2190ebb3aaec9ecd9b1cf8f7f6174c43153a/src/Xamarin.Android.Build.Tasks/Tasks/Proguard.cs)
102+
MSBuild task shrinks the compiled Java code if
103+
`$(AndroidEnableProguard)` is `True`. Developers may also supply
104+
custom proguard configuration files via `ProguardConfiguration`
105+
build items.
106+
4. The [CreateMultiDexMainDexClassList](https://github.com/xamarin/xamarin-android/blob/221a2190ebb3aaec9ecd9b1cf8f7f6174c43153a/src/Xamarin.Android.Build.Tasks/Tasks/CreateMultiDexMainDexClassList.cs)
107+
MSBuild task runs `proguard` to generate a final, combined
108+
`multidex.keep` file if `$(AndroidEnableMultiDex)` is `True`.
109+
Developers can also supply custom `multidex.keep` files via
110+
`MultiDexMainDexList` build items.
111+
5. The [CompileToDalvik](https://github.com/xamarin/xamarin-android/blob/221a2190ebb3aaec9ecd9b1cf8f7f6174c43153a/src/Xamarin.Android.Build.Tasks/Tasks/CompileToDalvik.cs)
112+
MSBuild task runs `dx.jar` to generate a final `classes.dex` file
113+
in `$(IntermediateOutputPath)android\bin`. If `multidex` is
114+
enabled, a `classes2.dex` (and potentially more) are also generated
115+
in this location.
116+
117+
# What will this process look like with D8 / R8?
118+
119+
Two new MSBuild tasks named `R8` and `D8` will be created.
120+
121+
1. The [Javac](https://github.com/xamarin/xamarin-android/blob/221a2190ebb3aaec9ecd9b1cf8f7f6174c43153a/src/Xamarin.Android.Build.Tasks/Tasks/Javac.cs)
122+
MSBuild task will remain unchanged.
123+
2. `D8` will run if `$(AndroidEnableMultiDex)` is `False`,
124+
`$(AndroidLinkTool)` is not `r8`, and "desugar" by default.
125+
3. Otherwise, `R8` will run if `$(AndroidEnableMultiDex)` is `True` or
126+
`$(AndroidLinkTool)` is `r8` and will also "desugar" by default.
127+
128+
So in addition to be being faster in general (if Google's claims are
129+
true), we will be calling a *single* command line tool to produce dex
130+
files!
131+
132+
# So how do developers use it? What are sensible MSBuild property defaults?
133+
134+
Currently, a `csproj` file might have the following properties:
135+
```xml
136+
<Project>
137+
<PropertyGroup>
138+
<AndroidEnableProguard>True</AndroidEnableProguard>
139+
<AndroidEnableMultiDex>True</AndroidEnableMultiDex>
140+
<AndroidEnableDesugar>True</AndroidEnableDesugar>
141+
</PropertyGroup>
142+
</Project>
143+
```
144+
145+
To enable the new behavior, we should introduce two new enum-style
146+
properties:
147+
- `$(AndroidDexGenerator)` - supports `dx` or `d8`
148+
- `$(AndroidLinkTool)` - supports `proguard` or `r8`
149+
150+
But for an existing project, a developer could opt-in to the new
151+
behavior with two properties:
152+
```xml
153+
<Project>
154+
<PropertyGroup>
155+
<AndroidEnableProguard>True</AndroidEnableProguard>
156+
<AndroidEnableMultiDex>True</AndroidEnableMultiDex>
157+
<AndroidEnableDesugar>True</AndroidEnableDesugar>
158+
<!--New properties-->
159+
<AndroidDexGenerator>d8</AndroidDexGenerator>
160+
<AndroidLinkTool>r8</AndroidLinkTool>
161+
</PropertyGroup>
162+
</Project>
163+
```
164+
165+
There should be two new MSBuild properties to configure here, because:
166+
- You could use `D8` in combination with `proguard`, as `R8` is not
167+
"feature complete" in comparison to `proguard`.
168+
- You may not want to use code shrinking at all, but still use `D8`
169+
instead of `dx`.
170+
- You shouldn't be able to use `dx` in combination with `R8`, it
171+
doesn't make sense.
172+
- Developers should be able to use the existing properties for
173+
enabling code shrinking, `multidex`, and `desugar`.
174+
175+
Our reasonable defaults would be:
176+
- If `AndroidDexGenerator` is omitted, `dx` and `CompileToDalvik`
177+
should be used. Until D8/R8 integration is deemed stable and enabled
178+
by default.
179+
- If `AndroidDexGenerator` is `d8` and `AndroidEnableDesugar` is
180+
omitted, `AndroidEnableDesugar` should be enabled.
181+
- If `AndroidLinkTool` is omitted and `AndroidEnableProguard` is
182+
`true`, we should default `AndroidLinkTool` to `proguard`.
183+
184+
MSBuild properties default to something like:
185+
```xml
186+
<AndroidDexGenerator Condition=" '$(AndroidDexGenerator)' == '' ">dx</AndroidDexGenerator>
187+
<!--NOTE: $(AndroidLinkTool) would be blank if code shrinking is not used at all-->
188+
<AndroidLinkTool Condition=" '$(AndroidLinkTool)' == '' And '$(AndroidEnableProguard)' == 'True' ">proguard</AndroidLinkTool>
189+
<AndroidEnableDesugar Condition=" '$(AndroidEnableDesugar)' == '' And ('$(AndroidDexGenerator)' == 'd8' Or '$(AndroidLinkTool)' == 'r8') ">True</AndroidEnableDesugar>
190+
```
191+
192+
If a user specifies combinations of properties:
193+
- `AndroidDexGenerator` = `d8` and `AndroidEnableProguard` = `True`
194+
- `AndroidLinkTool` will get set to `proguard`
195+
- `AndroidDexGenerator` = `dx` and `AndroidLinkTool` = `r8`
196+
- This combination doesn't really *make sense*, but we don't need to
197+
do anything: only `R8` will be called because it dexes and shrinks
198+
at the same time.
199+
- `AndroidEnableDesugar` is enabled when omitted, if either `d8` or
200+
`r8` are used
201+
202+
For new projects that want to use D8/R8, code shrinking, and
203+
`multidex`, it would make sense to specify:
204+
```xml
205+
<Project>
206+
<PropertyGroup>
207+
<AndroidEnableMultiDex>True</AndroidEnableMultiDex>
208+
<AndroidDexGenerator>d8</AndroidDexGenerator>
209+
<AndroidLinkTool>r8</AndroidLinkTool>
210+
</PropertyGroup>
211+
</Project>
212+
```
213+
214+
# Additional D8 / R8 settings?
215+
216+
`--debug` or `--release` needs to be explicitly specified for both D8
217+
and R8. We should use the [AndroidIncludeDebugSymbols][debug_symbols]
218+
property for this.
219+
220+
`$(D8ExtraArguments)` and `$(R8ExtraArguments)` can be used to
221+
explicitly pass additional flags to D8 and R8.
222+
223+
# How are we compiling / shipping D8 and R8?
224+
225+
We will add a submodule to `xamarin-android` for
226+
[r8](https://r8.googlesource.com/r8/). It should be pinned to a commit
227+
with a reasonable release tag, such as `1.2.48` for now.
228+
229+
To build r8, we have to:
230+
- Download and unzip a tool named [depot_tools][depot_tools] from the
231+
Chromium project
232+
- Put the path to `depot_tools` in `$PATH`
233+
- Run `gclient` so it will download/bootstrap gradle, python, and
234+
other tools
235+
- Run `python tools\gradle.py d8 r8` to compile `d8.jar` and `r8.jar`
236+
- We will need to ship `d8.jar` and `r8.jar` in our installers,
237+
similar to how we are shipping `desugar_deploy.jar`
238+
239+
# Performance Comparison
240+
241+
| MSBuild Target | Options Enabled | Time | APK size (bytes) | dex size (bytes) |
242+
| --- | --- | ---: | ---: | ---: |
243+
| _CompileToDalvikWithDx | n/a | 11074ms | 13378157 | 3894720 |
244+
| _CompileToDalvikWithD8 | d8, (desugar enabled) | 8543ms | 13124205 | 3314064 |
245+
| _CompileToDalvikWithD8 | d8, (desugar disabled) | 9550ms | 13124205 | 3314064 |
246+
| _CompileToDalvikWithDx | multi-dex | 15632ms | 13390498 | 3916496 |
247+
| _CompileToDalvikWithD8 | d8, multi-dex | 25979ms | 13054626 | 3264096 |
248+
| _CompileToDalvikWithDx | proguard | 11903ms | 12804717 | 2446964 |
249+
| _CompileToDalvikWithD8 | d8, r8 | 13799ms | 12513901 | 1835588 |
250+
| _CompileToDalvikWithDx | multi-dex, proguard | 17279ms | 12804770 | 2449512 |
251+
| _CompileToDalvikWithD8 | d8, multi-dex, r8 | 13792ms | 12513954 | 1837588 |
252+
253+
_NOTE: desugar is enabled by default with d8/r8_
254+
255+
I timed this builds with [this script][powershell_script], with a "Hello World" Xamarin.Forms app. Build logs here: [d8andr8.zip][d8andr8_zip]
256+
257+
One can draw their own conclusions on which options are faster, better, smaller.
258+
259+
Some of my thoughts:
260+
- Default options for d8 and r8 seem to be faster?
261+
- Disabling `desugar` is slower?
262+
- Enabling `multi-dex` makes the dex file larger, because new classes are required. The app wasn't large enough to warrant a `classes2.dex`.
263+
- `d8` does not support multi-dex, and so choosing `d8` + `multi-dex` actually runs `r8` with `--no-tree-shaking --no-minification`. These options are _slower_?
264+
265+
[dex]: https://source.android.com/devices/tech/dalvik/dalvik-bytecode
266+
[multidex]: https://developer.android.com/studio/build/multidex
267+
[debug_symbols]: https://github.com/xamarin/xamarin-android/blob/221a2190ebb3aaec9ecd9b1cf8f7f6174c43153a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets#L315-L336
268+
[depot_tools]: http://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html
269+
[powershell_script]: https://github.com/jonathanpeppers/HelloWorld/blob/39e2854f6ca39c0941fb8bd6f2a16d8b7663003e/build.ps1
270+
[d8andr8_zip]: https://github.com/xamarin/xamarin-android/files/2470385/d8andr8.zip

Documentation/guides/messages/xa4304.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Compiler Error XA4304
1+
# Compiler Warning XA4304
22

33
The `Proguard` MSBuild task encountered a proguard configuration file
44
that was not found on disk. These files are generally declared in your
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Compiler Warning XA4305
2+
3+
The `CreateMultiDexMainDexClassList`, `CompileToDalvik` or `R8`
4+
MSBuild task encountered a `multidex.keep` file that was not found on
5+
disk. You can customize `multidex` settings for your Xamarin.Android
6+
application by adding files with the `MultiDexMainDexList` build item,
7+
which are combined into a final `multidex.keep` file.
8+
9+
To learn more about `multidex` and how it relates to Android
10+
development, see the [Android documentation][android].
11+
12+
## Resolution
13+
14+
Verify you are not declaring a `MultiDexMainDexList` build item that
15+
does not exist.
16+
17+
Consider submitting a [bug][bug] if you are getting this warning under
18+
normal circumstances.
19+
20+
[android]: https://developer.android.com/studio/build/multidex
21+
[bug]: https://github.com/xamarin/xamarin-android/wiki/Submitting-Bugs,-Feature-Requests,-and-Pull-Requests

Xamarin.Android.sln

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Android.Tools.Andro
123123
EndProject
124124
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Android.Tools.AndroidSdk-Tests", "external\xamarin-android-tools\src\Xamarin.Android.Tools.AndroidSdk\Tests\Xamarin.Android.Tools.AndroidSdk-Tests.csproj", "{1E5501E8-49C1-4659-838D-CC9720C5208F}"
125125
EndProject
126+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "r8", "src\r8\r8.csproj", "{1BAFA0CC-0377-46CE-AB7B-7BB2E7B62F63}"
127+
EndProject
126128
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "proprietary", "build-tools\proprietary\proprietary.csproj", "{D93CAC27-3893-42A3-99F1-2BCA72E186F4}"
127129
EndProject
128130
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "download-bundle", "build-tools\download-bundle\download-bundle.csproj", "{1DA0CB12-5508-4E83-A242-0C8D6D99A49B}"
@@ -358,6 +360,10 @@ Global
358360
{1DA0CB12-5508-4E83-A242-0C8D6D99A49B}.Debug|AnyCPU.Build.0 = Debug|Any CPU
359361
{1DA0CB12-5508-4E83-A242-0C8D6D99A49B}.Release|AnyCPU.ActiveCfg = Release|Any CPU
360362
{1DA0CB12-5508-4E83-A242-0C8D6D99A49B}.Release|AnyCPU.Build.0 = Release|Any CPU
363+
{1BAFA0CC-0377-46CE-AB7B-7BB2E7B62F63}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU
364+
{1BAFA0CC-0377-46CE-AB7B-7BB2E7B62F63}.Debug|AnyCPU.Build.0 = Debug|Any CPU
365+
{1BAFA0CC-0377-46CE-AB7B-7BB2E7B62F63}.Release|AnyCPU.ActiveCfg = Release|Any CPU
366+
{1BAFA0CC-0377-46CE-AB7B-7BB2E7B62F63}.Release|AnyCPU.Build.0 = Release|Any CPU
361367
EndGlobalSection
362368
GlobalSection(SolutionProperties) = preSolution
363369
HideSolutionNode = FALSE
@@ -418,8 +424,7 @@ Global
418424
{B8105878-D423-4159-A3E7-028298281EC6} = {04E3E11E-B47D-4599-8AFC-50515A95E715}
419425
{E34BCFA0-CAA4-412C-AA1C-75DB8D67D157} = {04E3E11E-B47D-4599-8AFC-50515A95E715}
420426
{1E5501E8-49C1-4659-838D-CC9720C5208F} = {CAB438D8-B0F5-4AF0-BEBD-9E2ADBD7B483}
421-
{D93CAC27-3893-42A3-99F1-2BCA72E186F4} = {E351F97D-EA4F-4E7F-AAA0-8EBB1F2A4A62}
422-
{1DA0CB12-5508-4E83-A242-0C8D6D99A49B} = {E351F97D-EA4F-4E7F-AAA0-8EBB1F2A4A62}
427+
{1BAFA0CC-0377-46CE-AB7B-7BB2E7B62F63} = {04E3E11E-B47D-4599-8AFC-50515A95E715}
423428
EndGlobalSection
424429
GlobalSection(ExtensibilityGlobals) = postSolution
425430
SolutionGuid = {53A1F287-EFB2-4D97-A4BB-4A5E145613F6}

external/r8

Submodule r8 added at 671655e

external/r8.tpnitems

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup Condition=" '$(TpnIncludeExternalDependencies)' == 'True' ">
4+
<ThirdPartyNotice Include="google/r8">
5+
<LicenseFile>$(MSBuildThisFileDirectory)\r8\LICENSE</LicenseFile>
6+
<SourceUrl>https://r8.googlesource.com/r8/</SourceUrl>
7+
</ThirdPartyNotice>
8+
</ItemGroup>
9+
</Project>

samples/HelloWorld/HelloWorld.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
1717
<AndroidUseLatestPlatformSdk>true</AndroidUseLatestPlatformSdk>
1818
<TargetFrameworkVersion>v7.1</TargetFrameworkVersion>
19+
<AndroidDexGenerator Condition=" '$(AndroidDexGenerator)' == '' ">d8</AndroidDexGenerator>
1920
</PropertyGroup>
2021
<Import
2122
Condition="Exists('..\..\Configuration.props')"

0 commit comments

Comments
 (0)