braintree_android
braintree_android copied to clipboard
Crash in cardinalcommerce
General information
- SDK/Library version: 4.15.0
- Environment: Production
- Android Version and Device: Wide range of Samsung (f.e. Node 4, 9; S 9, 10, 20, 20se, 21, 22; Z flip and my other models), Redme, OPPO, HUAWEI, Sony, OnePlus
- Braintree dependencies:
com.braintreepayments.api:three-d-secure:4.15.0
Issue description
Fatal Exception: java.lang.RuntimeException
Unable to start activity ComponentInfo{com.main.gopuff/com.braintreepayments.api.ThreeDSecureActivity}: java.lang.NullPointerException: Attempt to read from field 'java.lang.String com.cardinalcommerce.a.configure.init' on a null object reference
Stacktrace:
com.cardinalcommerce.cardinalmobilesdk.Cardinal.cca_continue (Unknown Source:21082) com.braintreepayments.api.CardinalClient.continueLookup (CardinalClient.java:44) com.braintreepayments.api.ThreeDSecureActivity.onCreateInternal (ThreeDSecureActivity.java:39) com.braintreepayments.api.ThreeDSecureActivity.onCreate (ThreeDSecureActivity.java:28) android.app.Activity.performCreate (Activity.java:6876) android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1135) android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3206) android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3349) android.app.ActivityThread.access$1100 (ActivityThread.java:221) android.app.ActivityThread$H.handleMessage (ActivityThread.java:1794) android.os.Handler.dispatchMessage (Handler.java:102) android.os.Looper.loop (Looper.java:158) android.app.ActivityThread.main (ActivityThread.java:7225) java.lang.reflect.Method.invoke (Method.java) com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1230) com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1120)
Hi @SerhiyPetrosyuk thanks for using the Braintree SDK for Android. Do you have any steps to reproduce? Or is this a crashlog from Google Play, etc.?
Hi @sshropshire It is just a stack trace from the firebase crashlytics. For now we don't have a proper way how to reproduce it.
We also encountered this crash issue, hope to see a solution here.
Hi @SerhiyPetrosyuk @Pingapplepie we've reached out to our 3rd Party MPI provider Cardinal and we're waiting to hear back. We'll post updates here when we receive more information on a fix.
Hi all - we are still waiting for an update from Cardinal and have nudged them again to provide a solution.
@sshropshire, @scannillo I'm at my wits end with this one, but I appear to be having the same issue.
This happens for me 100% of the time at the same point.
I call my ThreeDSecureClient's performVerification supplying a callback. In the callback I check that there's no error and then call continuePerformVerification. At the point my App looks like it's about to perform the browser switch to show the 3DS challenge it crashes.
I'm using the latest version of the Drop In (6.3.0) against our Sandbox account. All other aspects e.g., displaying Google Pay, displaying the Drop In, fetching the most recently used payment method all work fine.
This is the stacktrace I see in Android Studio:-
2022-10-18 13:13:52.166 6894-6894/com.mycompany.myapp E/AndroidRuntime: FATAL EXCEPTION: main Process: com.mycompany.myapp, PID: 6894 java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. at androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor(AppCompatDelegateImpl.java:852) at androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor(AppCompatDelegateImpl.java:815) at androidx.appcompat.app.AppCompatDelegateImpl.onPostCreate(AppCompatDelegateImpl.java:536) at androidx.appcompat.app.AppCompatActivity.onPostCreate(AppCompatActivity.java:151) at android.app.Instrumentation.callActivityOnPostCreate(Instrumentation.java:1403) at android.app.ActivityThread.handleStartActivity(ActivityThread.java:4087) at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221) at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201) at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2438) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:226) at android.os.Looper.loop(Looper.java:313) at android.app.ActivityThread.main(ActivityThread.java:8663) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135) 2022-10-18 13:13:53.188 7557-7557/com.mycompany.myapp E/AndroidRuntime: FATAL EXCEPTION: main Process: com.mycompany.myapp, PID: 7557 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mycompany.myapp/com.braintreepayments.api.ThreeDSecureActivity}: java.lang.NullPointerException: Attempt to read from field 'java.lang.String com.cardinalcommerce.a.configure.init' on a null object reference at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4035) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4201) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2438) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:226) at android.os.Looper.loop(Looper.java:313) at android.app.ActivityThread.main(ActivityThread.java:8663) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135) Caused by: java.lang.NullPointerException: Attempt to read from field 'java.lang.String com.cardinalcommerce.a.configure.init' on a null object reference at com.cardinalcommerce.cardinalmobilesdk.Cardinal.cca_continue(:21082) at com.braintreepayments.api.CardinalClient.continueLookup(CardinalClient.java:44) at com.braintreepayments.api.ThreeDSecureActivity.onCreateInternal(ThreeDSecureActivity.java:39) at com.braintreepayments.api.ThreeDSecureActivity.onCreate(ThreeDSecureActivity.java:28) at android.app.Activity.performCreate(Activity.java:8290) at android.app.Activity.performCreate(Activity.java:8270) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1329) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4009) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4201) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2438) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:226) at android.os.Looper.loop(Looper.java:313) at android.app.ActivityThread.main(ActivityThread.java:8663) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135) 2022-10-18 13:13:55.486 7744-7744/? E/USNET: USNET: appName: com.mycompany.myapp
I assume the initial error You need to use a Theme.AppCompat theme (or descendant) with this activity
is just a by-product of the earlier errors in the stacktrace as all of my activities, including the braintree ones all extend from AppCompat?
Has there been any update on this issue as it's severely delaying our next release? Or does anyone know of any workarounds?
Happy to provide more information if needed if I can!
I've tested the same 3DS flow on the iOS version of our App and it all works fine, so I'm not sure if this is something environmental in our Android App, or it is indeed an issue with the Android cardinal mobilesdk?
Cheers
Ben
Just a quick update to this. I'll reduce my estimate to this happening 99% of the time. I actually had one success today where the browser switch worked and I had the opportunity to enter my 3DS (sandbox) code.
However on entering the code, switching back to my App crashed.
Now I'm back to the usual case of calling continuePerformVerification and the App crashing with the same error:-
java.lang.NullPointerException: Attempt to read from field 'java.lang.String com.cardinalcommerce.a.configure.init' on a null object reference at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4035)
Looking forward to some updates from Cardinal :)
Cheers
Ben
Hi @soarb to confirm, does your app's theme extend an AppCompat
theme? e.g.
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
in your themes.xml
file (or whichever file used to define your app's theme)?
Hi @sshropshire, yes it extends Theme.AppCompat.DayNight.NoActionBar, but I just noticed, we've recently installed a new dependency to handle showing a splash screen for our App. This required changing to their theme which does NOT extend AppCompat :(
I've updated my config to switch back to our theme and have made several successful purchases against our Sandbox account and the 3DS flow worked perfectly.
Apologies for wasting your time, the stacktrace really confused me and led me to comment here.
As far as I'm concerned you can close this issue for me :)
Cheers
Benj
All good! We appreciate all feedback. Will close for now.
Hi @sshropshire, We still encountered the original issue on Firebase Crashlytics. We saw the ThreeDSecureActivit extends "AppCompatActivity", and our app theme extends "Theme.AppCompat.Light.NoActionBar". Here is the call stack. Could you help it again?
Fatal Exception: java.lang.RuntimeException Unable to start activity ComponentInfo{com.planetart.fpuk/com.braintreepayments.api.ThreeDSecureActivity}: java.lang.NullPointerException: Attempt to read from field 'java.lang.String com.cardinalcommerce.a.configure.getInstance' on a null object reference android.app.ActivityThread.performLaunchActivity (ActivityThread.java:4060) android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:4247) android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:91) android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:149) android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:103) android.app.ActivityThread$H.handleMessage (ActivityThread.java:2613) android.os.Handler.dispatchMessage (Handler.java:110) android.os.Looper.loop (Looper.java:219) android.app.ActivityThread.main (ActivityThread.java:8668) java.lang.reflect.Method.invoke (Method.java) com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:513) com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1109)
Caused by java.lang.NullPointerException Attempt to read from field 'java.lang.String com.cardinalcommerce.a.configure.getInstance' on a null object reference com.cardinalcommerce.cardinalmobilesdk.Cardinal.cca_continue (Unknown Source:22082) com.braintreepayments.api.CardinalClient.continueLookup (CardinalClient.java:44) com.braintreepayments.api.ThreeDSecureActivity.onCreateInternal (ThreeDSecureActivity.java:39) com.braintreepayments.api.ThreeDSecureActivity.onCreate (ThreeDSecureActivity.java:28) android.app.Activity.performCreate (Activity.java:8214) android.app.Activity.performCreate (Activity.java:8202) android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1320) android.app.ActivityThread.performLaunchActivity (ActivityThread.java:4033) android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:4247) android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:91) android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:149) android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:103) android.app.ActivityThread$H.handleMessage (ActivityThread.java:2613) android.os.Handler.dispatchMessage (Handler.java:110) android.os.Looper.loop (Looper.java:219) android.app.ActivityThread.main (ActivityThread.java:8668) java.lang.reflect.Method.invoke (Method.java) com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:513) com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1109)
Hi @JammyZ is this reproducible? Can you try out the latest 4.24.1-SNAPSHOT version and see if it resolves the issue?