Поделиться через


.NET для Android: ошибка/предупреждение XA1023

Примеры сообщений

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'.

Проблема

Google не рекомендует компилятор DX DEX в пользу компилятора D8 DEX. 1 февраля 2021 г. DX больше не будет частью пакета SDK для Android или Android Studio.

Компилятор DX DEX не поддерживается в .NET 6 или более поздней версии, а также в .NET для Android 12.4 и более поздних версий.

Решение

Обновите свойство MSBuild на d8 для выбора компилятора D8 DEX. Это свойство соответствует параметру компилятора Dex на страницах свойств проекта Visual Studio. Кроме того, удалите <AndroidDexTool> из CSPROJ-файла , чтобы разрешить сборке выбрать значение d8по умолчанию.