With MAUI/VS 2022, how does one specify an Android target version other than 34? The dropdown in Visual Studio only presents 34. If I manually edit the manifest, and turn off the option to "transform project properties into assembly attributes during build" I get this error:
error XA1036: AndroidManifest.xml //uses-sdk/@android:minSdkVersion '26' does not match the
$(SupportedOSPlatformVersion) value '21.0' in the project file (if there is no
$(SupportedOSPlatformVersion) value in the project file, then a default value has been
assumed).
error XA1036: Either change the value in the AndroidManifest.xml to match the
$(SupportedOSPlatformVersion) value, or remove the value in the AndroidManifest.xml (and add
a $(SupportedOSPlatformVersion) value to the project file if it doesn't already exist).
warning XA4211: AndroidManifest.xml //uses-sdk/@android:targetSdkVersion '31' is less than
$(TargetFrameworkVersion) ''. Using API-34 for ACW compilation.
4>Done building project ... -- FAILED.
I am pretty certain that I have all the necessary Android SDK's installed. Why does the Visual Studio 2022 not display them as options?
If you want to specify Android Target Version to target 31
, you can manually specify the SDK by manually adding the following code to the MAUI project's Platfroms/Android/AndroidMenifest.xaml
like below. You don't need to set the SDK in the dropdown in Visual Studio which is counterintuitive
<uses-sdk android:minSdkVersion=" " android:targetSdkVersion="31"/>
Also, it is recommended that you publish it to Visual Studio Feedback if you have any other concerns.