Home > other >  Xamarin Android Binding of Razorpay 1.6.26 (AAR) giving error
Xamarin Android Binding of Razorpay 1.6.26 (AAR) giving error

Time:11-07

I am making Xamarin Android Binding library of Razorpay 1.6.26 using AAR (https://repo1.maven.org/maven2/com/razorpay/checkout/1.6.26/checkout-1.6.26.aar) but its giving error due to a parameter type in OnRequestPermissionsResult method, which is declared as

OnRequestPermissionsResult (int p0, string[] p1, int[] p2) 

but it should be

OnRequestPermissionsResult (int p0, string[] p1, Permission[] p2)

I am trying to change through Metadata.xml using following attr code

<attr path="/api/package[@name='com.razorpay']/class[@name='CheckoutActivity']/method[@name='OnRequestPermissionsResult' and count(parameter)=3 and parameter[1][@type='int'] and parameter[2][@type='java.lang.String[]'] and parameter[3][@type='int[]']]/parameter[3]" name="type">Android.Content.PM.Permission[]</attr>

But its not working and error is as same as earlier

Severity    Code    Description Project File    Line    Suppression State
Error   CS0115  'CheckoutActivity.OnRequestPermissionsResult(int, string[], int[])': no 
suitable method found to override   RazorPayBindingNew

Any idea how to solve this?

CodePudding user response:

I have test the binding, and it seems there is something wrong in your Metadata.xml. You can try the following code:

<attr path="/api/package[@name='com.razorpay']/class[@name='CheckoutActivity']/method[@name='onRequestPermissionsResult' and count(parameter)=3 and parameter[1][@type='int'] and parameter[2][@type='java.lang.String[]'] and parameter[3][@type='int[]']]/parameter[3]" name="type">Android.Content.PM.Permission[]</attr>

And sorry for my mistake. The name="type" is right. The name="manageType" should be used to change return type.

And the 'OnRequestPermissionsResult' should be 'onRequestPermissionsResult'. I have checked the binding errors, the error message showed the name should be onRequestPermissionsResult. I have tested it, the error message disappeared when I changed it to onRequestPermissionsResult.

  • Related