Search code examples
xamarinxamarin.androidxamarin-binding

Xamarin Android Binding referencing Org.Apache.Xml.Security.Algorithms


I am trying to create a Xamarin Android binding library which is referencing org.apache.xml.security.transforms , Org.Apache.Xml.Security.Algorithms

Which reference I have to add to make sure it is working fine?

Sample errors

1>BINDINGSGENERATOR : warning BG8900: Type org.apache.xml.security.transforms.Transforms: FxDG naming violation: Type name 'Transforms' matches namespace part 'Transforms'.

\obj\Debug\generated\src\Org.Apache.Xml.Security.Algorithms.Implementations.IntegrityHmac.cs(150,20,150,31): warning CS0108: 'IntegrityHmac.IntegrityHmacRIPEMD160.GetDHandler()' hides inherited member 'IntegrityHmac.GetDHandler()'. Use the new keyword if hiding was intended.


Solution

  • These are not errors, but rather the binding generator giving you a couple of fair warnings.

    1>BINDINGSGENERATOR : warning BG8900: Type org.apache.xml.security.transforms.Transforms: FxDG naming violation: Type name 'Transforms' matches namespace part 'Transforms'.
    

    This is simply a warning telling you that the name Transforms matches part of the previous namespace org.apache.xml.security.transforms. Again this isn't a big issue unless these classes are not generating.

    \obj\Debug\generated\src\Org.Apache.Xml.Security.Algorithms.Implementations.IntegrityHmac.cs(150,20,150,31): warning CS0108: 'IntegrityHmac.IntegrityHmacRIPEMD160.GetDHandler()' hides inherited member 'IntegrityHmac.GetDHandler()'. Use the new keyword if hiding was intended.
    

    This warning is saying that the GetDHandler() implementation of IntegrityHmac.IntegrityHmacRIPEMD160 is being hidden. Typically this is an issue of obfuscation.

    I do have a general binding guide that has most of these aspects covered once you know what you're looking for:

    https://gist.github.com/JonDouglas/dda6d8ace7d071b0e8cb

    However after looking over your source, it seems that everything compiles just fine. There are a few notes here:

    1. Ensure you are compiling with the correct JDK. I used JDK 1.8 in testing yours, but the documentation of the SDK you are binding to might use a different one.
    2. Make sure you are using the correct Build Action for your JARs. You can find a recommended use case in our documentation: https://developer.xamarin.com/guides/android/advanced_topics/binding-a-java-library/#Build_Actions (InputJar does not embed into the .dll and must be found at runtime. Thus you should use EmbeddedJar)