locked
Struggling with Java binding (Using Xamarin Android) RRS feed

  • Question

  • User50747 posted

    Hello please help,

    I removed some namespaces in Metadata.xml while binding a java library like:

    <remove-node path="/api/package[@name='com.payu.india.Tasks']/class[@name='VerifyPaymentTask']" />

    After that java library successfully bind with my xamarin's java binding project, then i referenced that java binding project's dll with my demo project then i got error like:

    Error 1: 'Com.Payu.India.Tasks.VerifyPaymentTask' does not implement inherited abstract member 'Android.OS.AsyncTask.DoInBackground(params Java.Lang.Object[])' PayU Integration\PayUSdkLib\PayUSdkLib\obj\Debug\generated\src\Com.Payu.India.Tasks.VerifyPaymentTask.cs 9 23 PayUSdkLib

    Can anyone please help me that how can i solve this type of error....

    Thanks and Regards..

    Wednesday, November 4, 2015 9:44 AM

All replies

  • User109563 posted

    Unfortunately, Android Bindings are under-documented ;( it's a shame cause they could really be powerfull... maybe, you can try with name="managedType">Java.Lang.Object on the method DoInBackground (source : https://gist.github.com/brendanzagaeski/9607158. Ligne 70-80 )

    Wednesday, November 4, 2015 2:57 PM
  • User50747 posted

    Thanks @PhilippeTroller for your response, i already find solution for my question after lots of research.....

    Wednesday, November 4, 2015 3:27 PM
  • User109563 posted

    Nice @Ranjeet_Singh, could you please share your solution ? I think it could help me for future bindings :wink: Thank you in advance !

    Wednesday, November 4, 2015 3:41 PM
  • User50747 posted

    Sure @PhilippeTroller ,

    We have to note 3 main points while binding java libraries.

    1) Build Action of .jar file should be "EmbeddedJar".

    2) Remove namespace in metadata.xml like: <remove-node path="/api/package[@name='com.payu.india.Tasks']/class[@name='DeleteCardTask']" /> if we have error like: *Error 1 'Com.Payu.India.Tasks.DeleteCardTask' does not implement inherited abstract member 'Android.OS.AsyncTask.DoInBackground(params Java.Lang.Object[])' E:\FleetNo1\com.fleetno1\PayU Integration\PayUSdkLib\PayUSdkLib\obj\Debug\generated\src\Com.Payu.India.Tasks.DeleteCardTask.cs 9 23 PayUSdkLib *

    3) If we have any accessibility errors in any class the we have to Change these classes to visibility public like: public

    and so on, now try to build your java binding library so that you got your project's dll.

    If you still have any error, you can ask me anytime, i like to mesh with errors and excited to remove them...

    For more details, have a look on tutorial mentioned below:

    http://www.itexico.com/blog/bid/98568/Xamarin-Mobile-Development-Consuming-Java-Libraries-from-C-in-Xamarin-Android-Part-2

    Thanks

    Thursday, November 5, 2015 4:44 AM
  • User282777 posted

    @Ranjeet_Singh

    Hi

    I'm facing similar issues :(

    I tried your solution but no luck

    <remove-node path="/api/package[@name='com.payu.india.Tasks']/class[@name='DeleteCardTask']" />

    Here are my errors

    Tuesday, July 7, 2020 7:57 AM