[Java binding] Class does not implement inherited abstract member

LeonLaciLeonLaci USMember ✭✭
edited October 3 in Xamarin.Android

I'm trying to bind the Deezer SDK.

The signature of the class giving the error:

public final String doInBackground(DeezerRequest... requestList) { }

And in the api.xml I get this:

<method abstract="false" deprecated="not deprecated" final="true" name="doInBackground" native="false" return="java.lang.String" static="false" synchronized="false" visibility="public">
    <parameter name="requestList" type="com.deezer.sdk.network.request.DeezerRequest...">
    </parameter>
</method>

But I get the error for some reason:

'AsyncDeezerTask' does not implement inherited abstract member 'AsyncTask.DoInBackground (params Object[])'

And why does it say params Object[] instead of params DeezerRequest?

Hiding the whole class could work but the I do need the class, it's essential.

I tried implementing the method myself in Metadata.xml but I get an error saying how it is already defined. Tried changing the parameter type, doesn't work.

Tagged:

Best Answer

  • LeonLaciLeonLaci USMember ✭✭
    Accepted Answer

    Turns out this is a bug in Xamarin. Please fix it!

    What I had to do is to change the managed type of the parameter to params Java.Lang.Object [] and change the managed return type of the method to Java.Lang.Object.
    After that you should go to the generated code (obj/Debug/generated) and find you method and instead of public make it protected override. And that should fix the issues. It's annoying as you have to type that in every time you build.

    <attr path="/api/package[@name='com.deezer.sdk.network.request']/class[@name='AsyncDeezerTask']/method[@name='doInBackground' and count(parameter)=1 and parameter[1][@type='com.deezer.sdk.network.request.DeezerRequest...']]/parameter[1]" name="managedType">params Java.Lang.Object []</attr>
      <attr path="/api/package[@name='com.deezer.sdk.network.request']/class[@name='AsyncDeezerTask']/method[@name='doInBackground' and count(parameter)=1 and parameter[1][@type='com.deezer.sdk.network.request.DeezerRequest...']]" name="managedReturn">Java.Lang.Object</attr>
    

    Hopefully his bug will get resolved SOON!

Answers

  • LeonLaciLeonLaci USMember ✭✭

    Making the AsyncDeezerTask extend from java.lang.Object compiles but then I don't have the execute method (can't cast object to AsyncTask<>).

  • LeonLaciLeonLaci USMember ✭✭
    Accepted Answer

    Turns out this is a bug in Xamarin. Please fix it!

    What I had to do is to change the managed type of the parameter to params Java.Lang.Object [] and change the managed return type of the method to Java.Lang.Object.
    After that you should go to the generated code (obj/Debug/generated) and find you method and instead of public make it protected override. And that should fix the issues. It's annoying as you have to type that in every time you build.

    <attr path="/api/package[@name='com.deezer.sdk.network.request']/class[@name='AsyncDeezerTask']/method[@name='doInBackground' and count(parameter)=1 and parameter[1][@type='com.deezer.sdk.network.request.DeezerRequest...']]/parameter[1]" name="managedType">params Java.Lang.Object []</attr>
      <attr path="/api/package[@name='com.deezer.sdk.network.request']/class[@name='AsyncDeezerTask']/method[@name='doInBackground' and count(parameter)=1 and parameter[1][@type='com.deezer.sdk.network.request.DeezerRequest...']]" name="managedReturn">Java.Lang.Object</attr>
    

    Hopefully his bug will get resolved SOON!

Sign In or Register to comment.