stripe / stripe-terminal-android

Stripe Terminal Android SDK
https://stripe.dev/stripe-terminal-android/
Other
94 stars 46 forks source link

No field Companion of type Landroidx/lifecycle/ProcessLifecycleOwner$Companion crash #506

Closed martinezrmena closed 1 month ago

martinezrmena commented 2 months ago

Summary

I'm in the process to update to version 2.23.3 for Xamarin.Forms with an Android binding, previously we have been working with version 2.14.0, but since that last version is not able to scan devices with Android 14 devices I started the process of updating to 2.23.3.

Code to reproduce

Android version

Android 14.

Impacted devices (Android devices or readers)

M2 STRM26142047539 is where we are testing.

SDK version

2.23.3.

Other information

Screenshot 2024-09-15 at 2 55 32 PM Screenshot 2024-09-15 at 2 54 11 PM Screenshot 2024-09-15 at 2 53 34 PM

I include the full stack trace:

Java.Lang.IncompatibleClassChangeError: No field Companion of type Landroidx/lifecycle/ProcessLifecycleOwner$Companion; in class Landroidx/lifecycle/ProcessLifecycleOwner; or its superclasses (declaration of 'androidx.lifecycle.ProcessLifecycleOwner' appears in /data/app/~~H10nqsxYR69kAjqjZENNVg==/com.tsdweb.cirro-kiyZSj_GbibtTArlV6BfuA==/base.apk) at Java.Interop.JniEnvironment+StaticMethods.CallStaticVoidMethod (Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue args) [0x00068] in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/obj/Release/JniEnvironment.g.cs:13250 at Java.Interop.JniPeerMembers+JniStaticMethods.InvokeVoidMethod (System.String encodedMember, Java.Interop.JniArgumentValue parameters) [0x00008] in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.JniStaticMethods.cs:97 at Com.Stripe.Stripeterminal.TerminalApplicationDelegate.OnCreate (Android.App.Application application) [0x00029] in /Users/megsoftdev/Documents/Projects/CirroMobile-Stripe Update/2_23_3/CirroMobile/Cirro.StripeTerminalCore/obj/Debug/generated/src/Com.Stripe.Stripeterminal.TerminalApplicationDelegate.cs:69 at Cirro.Droid.MainActivity.OnCreate (Android.OS.Bundle bundle) [0x001aa] in /Users/megsoftdev/Documents/Projects/CirroMobile-Stripe Update/2_23_3/CirroMobile/Cirro/Cirro.Android/MainActivity.cs:151 at Android.App.Activity.n_OnCreate_Landroid_osBundle (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) [0x00010] in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/monoandroid10/android-33/mcw/Android.App.Activity.cs:2826 at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPL_V (_JniMarshal_PPL_V callback, System.IntPtr jnienv, System.IntPtr klazz, System.IntPtr p0) [0x00005] in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:121 at (wrapper native-to-managed) Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPL_V(intptr,intptr,intptr) --- End of managed Java.Lang.IncompatibleClassChangeError stack trace --- java.lang.NoSuchFieldError: No field Companion of type Landroidx/lifecycle/ProcessLifecycleOwner$Companion; in class Landroidx/lifecycle/ProcessLifecycleOwner; or its superclasses (declaration of 'androidx.lifecycle.ProcessLifecycleOwner' appears in /data/app/~~H10nqsxYR69kAjqjZENNVg==/com.tsdweb.cirro-kiyZSj_GbibtTArlV6BfuA==/base.apk) at com.stripe.stripeterminal.TerminalApplicationDelegate.onCreate(TerminalApplicationDelegate.kt:29) at crc643a9f6031a4fa656e.MainActivity.n_onCreate(Native Method) at crc643a9f6031a4fa656e.MainActivity.onCreate(MainActivity.java:43) at android.app.Activity.performCreate(Activity.java:8595) at android.app.Activity.performCreate(Activity.java:8573) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1456) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3764) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3922) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:139) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:96) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2443) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:205) at android.os.Looper.loop(Looper.java:294) at android.app.ActivityThread.main(ActivityThread.java:8177) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)

xiaoshen-stripe commented 1 month ago

Hi there, thank you for reaching out. We believe this is due to incompatibility between Xamarin.Forms and AndroidX dependencies in Stripe Terminal V2, which is no longer supported as of September 2024 [0].

We encourage you to update to Terminal Android SDK v3 or later for continued functionality - see detailed migration guide here [1].

Also as you may be aware - Xamarin.Forms official support by Microsoft ended earlier this year on May 1st, 2023. The official recommendation is for you to migrate to other cross-platform frameworks like .NET Maui [2].

[0] https://github.com/stripe/stripe-terminal-android/blob/master/SUPPORT.md#release-status [1] https://docs.stripe.com/terminal/references/sdk-migration-guide?terminal-sdk-platform=android [2] https://dotnet.microsoft.com/en-us/apps/xamarin/xamarin-forms