没有实现接口成员'IComparable.CompareTo(Object)' [英] does not implement interface member 'IComparable.CompareTo(Object)'
问题描述
我有一个android的.aar文件.我正在尝试在我的xamarin.android应用程序中使用它.我按照链接
要解决此问题,需要在"添加项"文件夹中创建需要接口成员实现"IComparable.CompareTo(Object)"的库类的部分类,如下所示:
名称空间应与绑定库中的名称空间相同,在这种情况下,名称空间应为:" Hirondelle.Date4j ".
使用Java.Lang;命名空间Hirondelle.Date4j{公共局部类DateTime:Object,IComparable{int IComparable.CompareTo(Object obj){返回CompareTo((DateTime)obj);}}}
然后应该成功构建库.
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.
这篇关于没有实现接口成员'IComparable.CompareTo(Object)'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!