Error in Xamarin and Android 12

David Eberle 21 Reputation points
2022-03-09T21:06:50.937+00:00

I have an application in Xamarin, that when trying to compile for Android 12, throws the following error:

java.lang.AssertionError: annotationType() : unrecognized Attribute name MODULE (class com.sun.tools.javac.util.SharedNameTable$NameImpl)

I tried the solution of this post, and it didn't work

https://stackoverflow.com/questions/68344424/unrecognized-attribute-name-module-class-com-sun-tools-javac-util-sharednametab

181558-image.png
181548-image.png

java version:

openjdk version "11.0.14" 2022-01-18 LTS  
OpenJDK Runtime Environment Microsoft-30257 (build 11.0.14+9-LTS)  
OpenJDK 64-Bit Server VM Microsoft-30257 (build 11.0.14+9-LTS, mixed mode)  

any idea what else it could be?

PS: sorry for my english

Developer technologies | .NET | Xamarin
0 comments No comments
{count} votes

Answer accepted by question author
  1. Anonymous
    2022-03-10T02:08:32.22+00:00

    Hello,​

    trying to compile for Android 12

    Based your screenshot, your target framework is Android 11. Please re-select the Repository in the Android SDKs and Tools. Change the SDK Manager from Microsoft-managed repository to use Google's repository.

    Then install Android 12 SDK Platform 31 in the Android SDKs and Tools, after that, you can select Android 12 S in your Compile Using Android version(Target Framework ).

    If you want to change JDK 11 in Visual Studio, Please refer to this thread: Install JDK-11 and Configure Visual Studio to use JDK-11 step by step.

    After above ways, please rebuild your application.

    Best Regards,

    Leon Lu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


1 additional answer

Sort by: Most helpful
  1. David Eberle 21 Reputation points
    2022-03-11T14:17:19.727+00:00

    didn't work, the error is still the same:
    182311-image.png

    I clean and rebuild the solution.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.