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.
VS version: 16.10.2
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I get this compile error in my Xamarin Android project.
It used to build a week ago. I upgraded VS2019 from 16.9.6 to 16.10.2 since, maybe that changed something?
java.lang.AssertionError: annotationType() : unrecognized Attribute name MODULE (class com.sun.tools.javac.util.SharedNameTable$NameImpl) collusive.app.Android
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.
VS version: 16.10.2
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.
Switch to Visual Studio 2022 fixed it in my case.
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.
Switching to Visual Studio 2022 worked for me too...Thanks for suggesting that..