I have an .aar
third party library that I want to use in Xamarin Android. So I created a new Android Bindings Library
, added the aar
-library and changed the Build action
of the aar
file to LibraryProjectZip
like described here: https://learn.microsoft.com/en-us/xamarin/android/platform/binding-java-library/binding-an-aar
Nothing else was changed and I would expect the project to compile and generate a dll
file.
Instead I get a lot of errors saying Error CS0542 'xy': member names cannot be the same as their enclosing type
.
When I jump to the origin of the error, I find the errors in generated code by Visual Studio with the classes looking something like:
public abstract class Albumin : Java.Lang.Object {
internal Albumin ()
{
}
// (removed for readability)
[Register ("ALBUMIN")]
public const string Albumin = (string) "albumin";
I cannot modify the source code of the library.
What can I do in order to build the Binding Library
successfully?
Thank you very much @Leo Zhu for the answer in the comments:
The solution is Renaming Members. So in my case the
Metadata.xml
in dieBinings Library
would look like the following: