How to change the extends in xamarin.android binding ?

mc 3,641 Reputation points
2021-03-31T09:22:32.133+00:00

I want to binding a aar to android.

but there is an error:
ApkUpgradeInfo”不实现接口成员“IComparator.Compare(Object?, Object?)”

the code is :

public partial class ApkUpgradeInfo : global::Sdk.Service.Storekit.Bean.JsonBean, global::Java.IO.ISerializable, global::Java.Util.IComparator {

I want to remove the last global::Java.Util.IComparator{

how to remove it in metadata.xml?

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,293 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. JarvanZhang 23,936 Reputation points
    2021-03-31T12:17:47.013+00:00

    class does not implement the interface member

    This is a problem that occurs with binding Java methods with covariant return types. To fix the issue, try to add a partial class declaration for the 'ApkUpgradeInfo' class and explicitly implement IComparator.Compare method. Or remove the covariance from the generated C# code.

    Check the link:
    https://learn.microsoft.com/en-us/xamarin/android/platform/binding-java-library/troubleshooting-bindings#possible-causes-6