Solution 1 :
Just pasting this here so we can close the question.
You get this error java.lang.AbstractMethodError: abstract method "void com.google.android.gms.tasks.OnSuccessListener.onSuccess(java.lang.Object)"
whenever your google play services packages is not compatible with the library you are trying to add.
So you would either have to change the version of your Google Play Services packages, or change the version of your AAR library file.
Problem :
I am trying to add Razor Pay to my Xamarin Form App, Though there is no direct way I created a binding Library from aar file.
as per Razor Pay document I added few line of code which is sufficient to work with test account but I am facing an Error which I am not sure how to solve it
Here is the Exception which is thrown
com.google.android.gms.tasks.OnSuccessListener.onSuccess(java.lang.Object)
here is my call stack
07-12 21:36:07.276 D/com.razorpay.checkout( 9046): java.lang.AbstractMethodError: abstract method
"void com.google.android.gms.tasks.OnSuccessListener.onSuccess(java.lang.Object)"
07-12 21:36:07.276 D/com.razorpay.checkout( 9046): at
com.google.android.gms.tasks.zzn.run(Unknown Source:4)
07-12 21:36:07.276 D/com.razorpay.checkout( 9046): at
android.os.Handler.handleCallback(Handler.java:873)
07-12 21:36:07.276 D/com.razorpay.checkout( 9046): at
android.os.Handler.dispatchMessage(Handler.java:99)
Here is my Code which i have implemented
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity, IPaymentResultWithDataListener, IOnSuccessListener, IOnFailureListener
{
public App app;
protected override void OnCreate(Bundle savedInstanceState)
{
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
base.OnCreate(savedInstanceState);
Checkout.Preload(this);
Checkout checkOut = new Checkout();
checkOut.SetKeyID("MyAPIKEY");
Forms.SetFlags("IndicatorView_Experimental");
Xamarin.Essentials.Platform.Init(this, savedInstanceState);
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
CachedImageRenderer.Init(true);
Window.SetStatusBarColor(Android.Graphics.Color.Rgb(13, 141, 190));
app = new App();
LoadApplication(app);
if (IsPlayServiceAvailable() == false)
{
throw new System.Exception("This device does not have Google Play Services and cannot receive push notifications.");
}
CreateNotificationChannel();
LoginWithSocialIconViewModel.AuthenticateAction += OAuthGoogle;
Window.SetSoftInputMode(Android.Views.SoftInput.AdjustResize);
Activity activity = this;
JSONObject options = new JSONObject();
options.Put("description", "My Sample Payment activity");
options.Put("order_id", "order_EAMgUyLXrMfbmL");
options.Put("currency", "INR");
options.Put("amount", "100");
checkOut.Open(activity, options);
}
Can someone figure it out what m I missing
Comments
Comment posted by Saamer
You might have to update your google play services packages, it might not be compatible. What version are you using, and what version does razor pay recommend?
Comment posted by Ronak Shethia
@Saamer I downgraded my checkout arr file to 1.5.18 to 1.5.14 and it worked
Comment posted by Ronak Shethia
I downgraded my AAR file version and it worked well but my Google play service were updated to latest how I determined which version of Google play service would be compatible with my AAR library file ?
Comment posted by Saamer
You have to look at the details of the AAR library file. Check to see which version of the Play Services libraries it is using