0
votes

I have created all my .gradle files (.jar and .aar) through Android Studio.

The .jar files compile to .dll files through the android bindings in Xamarin without any issues - and I can expand them in object explorer Visual Studio when including them as references.

My problem is with the .aar files.

I have the mapbox-android-core-1.4.0.aar file from the gradle in my Jars folder in Visual Studio.

The build action is set to "LibraryProjectZip" and under references I have included Xamarin.Android.Support.v7.AppCompat which then included all other android support dependencies.

The Android Compile version is Android 9.0 Android class parser: class-parse Android codegen target: XAJavaInterop1

When I build i get the following error:

Error CS0535 'FileUtils.LastModifiedComparator' does not implement interface member 'IComparator.Compare(Object, Object)'

The official Xamarin troublehsooting says I must add the managed return to metadata which I did as follows:

<attr path="/api/package[@name='com.mapbox.android.core']/class[@name='FileUtils']/method[@name='FileUtils.LastModifiedComparator']" name="managedReturn">java.lang.Object</attr>

With this added it still has exactly the same error, so I am not sure where I am going wrong.

Do I need to add a partial class to Additions or is the attr> above sufficient - just using the wrong information inside it, or am I missing what the error is in the first place?

1

1 Answers

0
votes

Error CS0535 'FileUtils.LastModifiedComparator' does not implement interface member 'IComparator.Compare(Object, Object)'

To fix this issue, try to add a partial class declaration for 'LastModifiedComparator' class and explicitly implement IComparator.Compare(Object, Object):

public partial class DeviceService
{
    public void Compare(object a, object b)
    {
        ...
    }
}

In your case, the method name in <attr ...> tag should be Compare instead of the 'LastModifiedComparator' method.

Check the tutorial:

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

Similar issue: error CS0535 Class does not implement interface member