I'm facing this same issue when trying to compile Xamarin Android with Target Framework Android 11.0.99 (S). Changing to Android 11.0 (R) works fine.
This discussion is quite old, you should be able to use the latest API 33 with no issue. The Android designer also has a way to work alongside JDK 11 being installed.
Yes, we've found the above issue is due to the android.jar from API 31 containing Java 9 class attributes inside.
Same issue occurs with Android Studio projects.
The recommended solution is to use JDK 11, we have a Microsoft distribution here: https://learn.microsoft.com/java/openjdk/download
The only dilemma is that the Android designer doesn't support JDK 11 yet. So you may want to stick with API 30, if you use the designer.
We hope to address the issues here in a future Visual Studio 2022 release.
Upgrading to JDK 11 didn't work for me. Is there anything more i have to include ?
Details :
Visual Studio 2019,
Xamarin Android Project,
Version is shown as 11.0.99 (though in Android studio it is shown as 12)
I have the same problem. It is related to compiling for Android 12 (uses-sdk android:targetSdkVersion="31")
Clean and rebuild didn't help.
Perhaps upgrading the JDK to 11 will fix this but I haven't tried it yet.