Razorpay 1.6.26(AAR)的Xamarin Android绑定出现错误

3npbholx  于 2022-12-07  发布在  Android
关注(0)|答案(1)|浏览(96)

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?

1zmg4dgp

1zmg4dgp1#

我已经测试了绑定,似乎Metadata.xml中有一些错误。您可以尝试以下代码:

<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>

很抱歉我的错误。name="type"是正确的。name="manageType"应该用来改变返回类型。
'OnRequestPermissionsResult'应该是'onRequestPermissionsResult'。我已经检查了绑定错误,错误消息显示名称应该是onRequestPermissionsResult。我已经测试了它,当我把它改为onRequestPermissionsResult时,错误消息消失了。

相关问题