Example messages (メッセージの例)
warning XA1026: Using AAPT is deprecated in favor of AAPT2. Please enable 'Use incremental Android packaging system (aapt2)' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidUseAapt2' MSBuild property to 'true'.
error XA1026: Using AAPT is not supported in .NET for Android projects that target .NET 6 or higher. Please enable 'Use incremental Android packaging system (aapt2)' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidUseAapt2' MSBuild property to 'true'.
問題点
Google は、 AAPT2 を優先して AAPT コマンドライン ツールを非推奨にしました。 .NET for Android では、 <AndroidUseAapt2>false</AndroidUseAapt2>
も非推奨になりました。
解決策
MSBuild プロパティを に更新して、AAPT2 を選択します。 このプロパティは、Visual Studio プロジェクトのプロパティ ページの [ インクリメンタル Android パッケージ システムの使用 (aapt2)] 設定に対応します。 または、.csproj ファイルから<AndroidUseAapt2>
を削除して、ビルドで既定値のtrue
を選択できるようにします。
重要
AAPT2 では、以前の AAPT よりもリソース ファイルに厳密な規則が適用される場合があるため、Android ビルド タスク用の .NET からではなく、AAPT2 自体から送信される新しいエラー メッセージが表示される場合は、いくつかの調整が必要になる場合があります。
必要に応じて、 --legacy
スイッチは AAPT 互換モードで AAPT2 を実行できます。
次を .csproj ファイルに追加します。
<PropertyGroup>
<AndroidAapt2CompileExtraArgs>--legacy</AndroidAapt2CompileExtraArgs>
</PropertyGroup>