I have an .aar file of android. I am trying to use it in my xamarin.android app. I followed the steps from the given in the link https://developer.xamarin.com/guides/android/advanced_topics/binding-a-java-library/binding-an-aar/
but when I am trying to build my library I am getting following error
"does not implement interface member 'IComparable.CompareTo(Object)'"
I found some solution for it where it is mentioned that in metadata.xml we need to add some attribute. so I added the following line there
path="/api/package[@name='com.logicjunction.ljindoorandroidsdk']/class[@name='FloorPlanBeaconsMapping']/implements[@name='java.lang.Comparable']"
name="type">java.lang.Comparable>
But still getting same error. How I can fix this?
Getting the error when build the library without interface implementation IComparable.CompareTo:
To resolve the issue, need create at "Additions" folder a partial class of the library class that requires interface member implementation 'IComparable.CompareTo(Object)', like below:
The namespace should be the same like at binding library, in this case, it is: "Hirondelle.Date4j".
using Java.Lang;
namespace Hirondelle.Date4j
{
public partial class DateTime : Object, IComparable
{
int IComparable.CompareTo(Object obj)
{
return CompareTo((DateTime)obj);
}
}
}
Then the library should be built with success.
So I had the same problem which I could solve it by helping the compiler in adding those lines in Metada.xml
(Transforms
folder) :
<add-node path="/api/package[@name='<JAVA_PACKAGE_NAME>']/class[@name='<CLASS_NAME>']">
<method name="compareTo" return="int" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public">
<parameter name="p0" type="java.lang.Object" />
</method>
</add-node>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With