.NET for Android error/warning XA5300

Issue

The XA5300 error is generated when the required Android SDK or Java SDK cannot be located during the build.

Solution

This can be fixed on the command-line by overriding either the $(AndroidSdkDirectory) or $(JavaSdkDirectory) MSBuild properties:

dotnet build -p:AndroidSdkDirectory=path/to/android/sdk -p:JavaSdkDirectory=path/to/jdk

Instructions to manually install the Android SDK or Java SDK are at: https://aka.ms/dotnet-android-install-sdk

This can also be fixed within Visual Studio options.

Consider submitting a bug if you are getting this failure under normal circumstances.