When using Visual Studio 2022 to build a MAUI application targeting Android, you might see an error along the lines of "could not find android.jar for API level ##". The error message below shows for API version 31:
When using Visual Studio 2022 to build a MAUI application targeting Android, you might see an error along the lines of "could not find android.jar for API level ##". The error message below shows for API version 31:
To fix that, go to Tools | Android | Android SDK Manager and inspect the dialog there:
What's a bit confusing to this dialog is that is you scan the Name column ("1", in the image), you'll see only references to API 32 and then Android 12, 11, etc. You might be looking for the SDK for the API Level 31 and you won't see it in the name... Instead, look at the API Level column ("2", in the image) and there you'll see the API Levels listed. The error message I saw indicated that the android.jar for API Level 31 was not found and that's because it's not checked. My job now is to check the "Android 12.0 - S" entry a click Apply Changes. After that, that missing SDK error should be resolved. If it isn't, check the path cited in the error message to ensure that the android.jar file is there. If it is, restart Visual Studio 2022. If it isn't then the SDK reinstall did not succeed and you should use the Android SDKs and Tools dialog to uninstall/reinstall the API Level SDK in question.