Forum Xamarin.Android

unable to create binding for AndroidProcess library - class does not implement interface member

StephanSteinerStephanSteiner CHMember
edited June 2016 in Xamarin.Android


I'm trying to create a binding for the AndroidProcess library found here:

If I create a new project, add the aar, and set the proper build action, things work fine. Then I change something in the build (e.g. in preparation for a release), and then the Bindings Library no longer builds - instead I get the error that AndroidProcesses.ProcessComparator does not implement interface member IComparator.Compare(object, object).

So I went searching and found that you could add a partial class that implements the method (the autogenerated class does have a method

public unsafe int Compare (global::Com.Jaredrummler.Android.Processes.Models.AndroidProcess p0,      global::Com.Jaredrummler.Android.Processes.Models.AndroidProcess p1)

but what the compiler is looking for is

public int Compare(Java.Lang.Object lhs, Java.Lang.Object rhs)

So, I added a code file to the Additions folder named Com.Jaredrummler.Android.Processes.AndroidProcesses.cs, which contains this

namespace Com.Jaredrummler.Android.Processes
    public partial class AndroidProcesses: global::Java.Util.IComparator
        public int Compare(Java.Lang.Object lhs, Java.Lang.Object rhs)
            Com.Jaredrummler.Android.Processes.Models.AndroidProcess p1 = lhs as Com.Jaredrummler.Android.Processes.Models.AndroidProcess;
            Com.Jaredrummler.Android.Processes.Models.AndroidProcess p2 = rhs as Com.Jaredrummler.Android.Processes.Models.AndroidProcess;
            return string.Compare(p1.Name, p1.Name, true);

Problem solved, right? Not so fast.. it appears the compiler doesn't want to pick up my additions and the compilation still fails.

So I'm wondering what I'm missing here.. the library isn't too complex so I'm sure something like this can be handled but I'm just not doing it right.

Any help would be much appreciated.

@edit: I tried something else, this time adding something to the Metadata.xml


I was hoping this would turn the compare method into one that takes two java.langObject parameters rather than two com.jaredrummler.Android.Processes.AndroidProcess objects.. but it doesn't seem to take either.

Sign In or Register to comment.