question

6666666 avatar image
0 Votes"
6666666 asked JarvanZhang-MSFT commented

How to change the extends in xamarin.android binding ?

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?

dotnet-xamarinforms
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

JarvanZhang-MSFT avatar image
0 Votes"
JarvanZhang-MSFT answered JarvanZhang-MSFT commented

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://docs.microsoft.com/en-us/xamarin/android/platform/binding-java-library/troubleshooting-bindings#possible-causes-6

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Ican it be true that re-set the inherits?


 public class ApkUpgradeInfo:Java.Lang.Object{}
0 Votes 0 ·