相关文章推荐
完美的稀饭  ·  Error starting ...·  2 年前    · 
淡定的茶壶  ·  viewpager禁止滑动 - ...·  2 年前    · 
温暖的花生  ·  UE4 ...·  2 年前    · 

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

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.

If you are still having problems, file a new issue here: https://github.com/xamarin/xamarin-android/issues

Make sure to share any diagnostic MSBuild logs or android device logs. Thanks!

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.