Skip to content

Commit 22bc14b

Browse files
[One .NET] drop support for DX (dotnet#4920)
Context: https://android-developers.googleblog.com/2020/02/the-path-to-dx-deprecation.html On February 1, 2021 DX will be removed from the Android SDK. It is very possible this will happen before .NET 6 ships. There are also currently a few MSBuild tests that fail when using DX. * Drop support for DX in .NET 5+. Emit `XA1023` as an *error*. * Don't even include `Xamarin.Android.DX.targets` in .NET 5+ packages. * Add several tests to the `dotnet` category. * Any tests using `AndroidDexTool=dx` will be ignored. I left the `PackagingTest.CheckClassesDexIsIncluded()` test so that it verifies you get an `XA1023` build error when using DX with .NET 5+. Other changes: * There were some related warning messages that I moved to the `_CheckNonIdealConfigurations` MSBuild target. These seem like they should all be in the same MSBuild target.
1 parent b17a813 commit 22bc14b

File tree

22 files changed

+182
-64
lines changed

22 files changed

+182
-64
lines changed

Documentation/guides/OneDotNet.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ previous Xamarin.Android releases.
104104
`$(AndroidClassParser)` will be `class-parse` by default. `jar2xml`
105105
will not be supported.
106106

107+
`$(AndroidDexTool)` will be `d8` by default. `dx` will not be
108+
supported.
109+
107110
`$(AndroidCodegenTarget)` will be `XAJavaInterop1` by default.
108111
`XamarinAndroid` will not be supported.
109112

Documentation/guides/messages/xa1023.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
---
2-
title: Xamarin.Android warning XA1023
3-
description: XA1023 warning code
2+
title: Xamarin.Android error/warning XA1023
3+
description: XA1023 error/warning code
44
ms.date: 05/18/2020
55
---
6-
# Xamarin.Android warning XA1023
6+
# Xamarin.Android error/warning XA1023
77

88
## Example messages
99

1010
```
11-
warning XA1023: Using the DX DEX Compiler is deprecated. Please update `$(AndroidDexTool)` to `d8`.
11+
warning XA1023: Using the DX DEX Compiler is deprecated. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.
12+
```
13+
14+
```
15+
error XA1023: Using the DX DEX Compiler is not supported in Xamarin.Android projects that target .NET 5 or higher. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.
1216
```
1317

1418
## Issue
@@ -17,6 +21,8 @@ Google has deprecated the DX DEX Compiler in favor of the [D8 DEX
1721
Compiler][d8]. On [February 1, 2021][dx], DX will no longer be a part
1822
of Android SDK or Android Studio.
1923

24+
The DX DEX Compiler will not supported in .NET 5 or higher.
25+
2026
[d8]: https://developer.android.com/studio/command-line/d8
2127
[dx]: https://android-developers.googleblog.com/2020/02/the-path-to-dx-deprecation.html
2228

build-tools/installers/create-installers.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@
236236
<_MSBuildFiles Include="$(MSBuildSrcDir)\Xamarin.Android.D8.targets" />
237237
<_MSBuildFiles Include="$(MSBuildSrcDir)\Xamarin.Android.Designer.targets" />
238238
<_MSBuildFiles Include="$(MSBuildSrcDir)\Xamarin.Android.DesignTime.targets" />
239-
<_MSBuildFiles Include="$(MSBuildSrcDir)\Xamarin.Android.DX.targets" />
239+
<_MSBuildFiles Include="$(MSBuildSrcDir)\Xamarin.Android.DX.targets" Condition=" '$(PackageId)' != 'Microsoft.Android.Sdk' " />
240240
<_MSBuildFiles Include="$(MSBuildSrcDir)\Xamarin.Android.EmbeddedResource.targets" />
241241
<_MSBuildFiles Include="$(MSBuildSrcDir)\Xamarin.Android.FSharp.targets" />
242242
<_MSBuildFiles Include="$(MSBuildSrcDir)\Xamarin.Android.Legacy.targets" />

src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs

Lines changed: 10 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Xamarin.Android.Build.Tasks/Properties/Resources.resx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,12 @@ In this message, the term "binding" means a piece of generated code that makes i
395395
{0} - The file name of the library</comment>
396396
</data>
397397
<data name="XA1023" xml:space="preserve">
398-
<value>Using the DX DEX Compiler is deprecated. Please update `$(AndroidDexTool)` to `d8`.</value>
399-
<comment>The following are literal names and should not be translated: D8, DEX, `$(AndroidDexTool)`, `d8`</comment>
398+
<value>Using the DX DEX Compiler is deprecated. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</value>
399+
<comment>The following are literal names and should not be translated: DX, DEX, d8, AndroidDexTool.</comment>
400+
</data>
401+
<data name="XA1023_dotnet" xml:space="preserve">
402+
<value>Using the DX DEX Compiler is not supported in Xamarin.Android projects that target .NET 5 or higher. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</value>
403+
<comment>The following are literal names and should not be translated: DX, DEX, Xamarin.Android, .NET 5, d8, AndroidDexTool.</comment>
400404
</data>
401405
<data name="XA1024" xml:space="preserve">
402406
<value>Ignoring configuration file '{0}'. .NET configuration files are not supported in Xamarin.Android projects that target .NET 5 or higher.</value>

src/Xamarin.Android.Build.Tasks/Properties/xlf/Resources.cs.xlf

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,14 @@ In this message, the term "binding" means a piece of generated code that makes i
339339
{0} - The file name of the library</note>
340340
</trans-unit>
341341
<trans-unit id="XA1023">
342-
<source>Using the DX DEX Compiler is deprecated. Please update `$(AndroidDexTool)` to `d8`.</source>
343-
<target state="new">Using the DX DEX Compiler is deprecated. Please update `$(AndroidDexTool)` to `d8`.</target>
344-
<note>The following are literal names and should not be translated: D8, DEX, `$(AndroidDexTool)`, `d8`</note>
342+
<source>Using the DX DEX Compiler is deprecated. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</source>
343+
<target state="new">Using the DX DEX Compiler is deprecated. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</target>
344+
<note>The following are literal names and should not be translated: DX, DEX, d8, AndroidDexTool.</note>
345+
</trans-unit>
346+
<trans-unit id="XA1023_dotnet">
347+
<source>Using the DX DEX Compiler is not supported in Xamarin.Android projects that target .NET 5 or higher. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</source>
348+
<target state="new">Using the DX DEX Compiler is not supported in Xamarin.Android projects that target .NET 5 or higher. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</target>
349+
<note>The following are literal names and should not be translated: DX, DEX, Xamarin.Android, .NET 5, d8, AndroidDexTool.</note>
345350
</trans-unit>
346351
<trans-unit id="XA1024">
347352
<source>Ignoring configuration file '{0}'. .NET configuration files are not supported in Xamarin.Android projects that target .NET 5 or higher.</source>

src/Xamarin.Android.Build.Tasks/Properties/xlf/Resources.de.xlf

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,14 @@ In this message, the term "binding" means a piece of generated code that makes i
339339
{0} - The file name of the library</note>
340340
</trans-unit>
341341
<trans-unit id="XA1023">
342-
<source>Using the DX DEX Compiler is deprecated. Please update `$(AndroidDexTool)` to `d8`.</source>
343-
<target state="new">Using the DX DEX Compiler is deprecated. Please update `$(AndroidDexTool)` to `d8`.</target>
344-
<note>The following are literal names and should not be translated: D8, DEX, `$(AndroidDexTool)`, `d8`</note>
342+
<source>Using the DX DEX Compiler is deprecated. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</source>
343+
<target state="new">Using the DX DEX Compiler is deprecated. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</target>
344+
<note>The following are literal names and should not be translated: DX, DEX, d8, AndroidDexTool.</note>
345+
</trans-unit>
346+
<trans-unit id="XA1023_dotnet">
347+
<source>Using the DX DEX Compiler is not supported in Xamarin.Android projects that target .NET 5 or higher. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</source>
348+
<target state="new">Using the DX DEX Compiler is not supported in Xamarin.Android projects that target .NET 5 or higher. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</target>
349+
<note>The following are literal names and should not be translated: DX, DEX, Xamarin.Android, .NET 5, d8, AndroidDexTool.</note>
345350
</trans-unit>
346351
<trans-unit id="XA1024">
347352
<source>Ignoring configuration file '{0}'. .NET configuration files are not supported in Xamarin.Android projects that target .NET 5 or higher.</source>

src/Xamarin.Android.Build.Tasks/Properties/xlf/Resources.es.xlf

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,14 @@ In this message, the term "binding" means a piece of generated code that makes i
339339
{0} - The file name of the library</note>
340340
</trans-unit>
341341
<trans-unit id="XA1023">
342-
<source>Using the DX DEX Compiler is deprecated. Please update `$(AndroidDexTool)` to `d8`.</source>
343-
<target state="new">Using the DX DEX Compiler is deprecated. Please update `$(AndroidDexTool)` to `d8`.</target>
344-
<note>The following are literal names and should not be translated: D8, DEX, `$(AndroidDexTool)`, `d8`</note>
342+
<source>Using the DX DEX Compiler is deprecated. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</source>
343+
<target state="new">Using the DX DEX Compiler is deprecated. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</target>
344+
<note>The following are literal names and should not be translated: DX, DEX, d8, AndroidDexTool.</note>
345+
</trans-unit>
346+
<trans-unit id="XA1023_dotnet">
347+
<source>Using the DX DEX Compiler is not supported in Xamarin.Android projects that target .NET 5 or higher. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</source>
348+
<target state="new">Using the DX DEX Compiler is not supported in Xamarin.Android projects that target .NET 5 or higher. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</target>
349+
<note>The following are literal names and should not be translated: DX, DEX, Xamarin.Android, .NET 5, d8, AndroidDexTool.</note>
345350
</trans-unit>
346351
<trans-unit id="XA1024">
347352
<source>Ignoring configuration file '{0}'. .NET configuration files are not supported in Xamarin.Android projects that target .NET 5 or higher.</source>

src/Xamarin.Android.Build.Tasks/Properties/xlf/Resources.fr.xlf

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,14 @@ In this message, the term "binding" means a piece of generated code that makes i
339339
{0} - The file name of the library</note>
340340
</trans-unit>
341341
<trans-unit id="XA1023">
342-
<source>Using the DX DEX Compiler is deprecated. Please update `$(AndroidDexTool)` to `d8`.</source>
343-
<target state="new">Using the DX DEX Compiler is deprecated. Please update `$(AndroidDexTool)` to `d8`.</target>
344-
<note>The following are literal names and should not be translated: D8, DEX, `$(AndroidDexTool)`, `d8`</note>
342+
<source>Using the DX DEX Compiler is deprecated. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</source>
343+
<target state="new">Using the DX DEX Compiler is deprecated. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</target>
344+
<note>The following are literal names and should not be translated: DX, DEX, d8, AndroidDexTool.</note>
345+
</trans-unit>
346+
<trans-unit id="XA1023_dotnet">
347+
<source>Using the DX DEX Compiler is not supported in Xamarin.Android projects that target .NET 5 or higher. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</source>
348+
<target state="new">Using the DX DEX Compiler is not supported in Xamarin.Android projects that target .NET 5 or higher. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</target>
349+
<note>The following are literal names and should not be translated: DX, DEX, Xamarin.Android, .NET 5, d8, AndroidDexTool.</note>
345350
</trans-unit>
346351
<trans-unit id="XA1024">
347352
<source>Ignoring configuration file '{0}'. .NET configuration files are not supported in Xamarin.Android projects that target .NET 5 or higher.</source>

src/Xamarin.Android.Build.Tasks/Properties/xlf/Resources.it.xlf

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,14 @@ In this message, the term "binding" means a piece of generated code that makes i
339339
{0} - The file name of the library</note>
340340
</trans-unit>
341341
<trans-unit id="XA1023">
342-
<source>Using the DX DEX Compiler is deprecated. Please update `$(AndroidDexTool)` to `d8`.</source>
343-
<target state="new">Using the DX DEX Compiler is deprecated. Please update `$(AndroidDexTool)` to `d8`.</target>
344-
<note>The following are literal names and should not be translated: D8, DEX, `$(AndroidDexTool)`, `d8`</note>
342+
<source>Using the DX DEX Compiler is deprecated. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</source>
343+
<target state="new">Using the DX DEX Compiler is deprecated. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</target>
344+
<note>The following are literal names and should not be translated: DX, DEX, d8, AndroidDexTool.</note>
345+
</trans-unit>
346+
<trans-unit id="XA1023_dotnet">
347+
<source>Using the DX DEX Compiler is not supported in Xamarin.Android projects that target .NET 5 or higher. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</source>
348+
<target state="new">Using the DX DEX Compiler is not supported in Xamarin.Android projects that target .NET 5 or higher. Please set the DEX compiler to 'd8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidDexTool' MSBuild property to 'd8'.</target>
349+
<note>The following are literal names and should not be translated: DX, DEX, Xamarin.Android, .NET 5, d8, AndroidDexTool.</note>
345350
</trans-unit>
346351
<trans-unit id="XA1024">
347352
<source>Ignoring configuration file '{0}'. .NET configuration files are not supported in Xamarin.Android projects that target .NET 5 or higher.</source>

0 commit comments

Comments
 (0)