.NET för Android-fel/varning XA1023

Exempelmeddelanden

error XA1023: Using the DX DEX Compiler is not supported. 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'.
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'.
error XA1023: Using the DX DEX Compiler is not supported in .NET for Android projects that target .NET 6 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'.

Problematik

Google har föråldrat DX DEX Compiler till förmån för D8 DEX Compiler. Den 1 februari 2021 kommer DX inte längre att ingå i Android SDK eller Android Studio.

DX DEX-kompilatorn stöds inte i .NET 6 eller senare, inte heller i .NET för Android 12.4 och senare.

Lösning

$(AndroidDexTool) Uppdatera egenskapen MSBuild till d8 för att välja D8 DEX-kompilatorn. Den här egenskapen motsvarar dex-kompilatorinställningen på visual studio-projektegenskapernas sidor. Du kan också ta bort <AndroidDexTool> från .csproj-filen så att bygget kan välja standardvärdet d8.