question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Crash during 3DS when Android kills the app

See original GitHub issue

General information

  • SDK/Library version: 4.14.0 (tested as reproducible also in 4.15.0)
  • Environment: Sandbox and Production
  • Android Version and Device: doesn’t matter
  • Braintree dependencies: "com.braintreepayments.api:three-d-secure:4.14.0"

Issue description

The issue appears during a 3DS checkout. If user put the app in background and Android kills the app’s process, when user returns to 3DS screen and proceed with 3DS the app crashes.

Step to reproduce

It’s reproducible using Demo app:

  1. enable 3D secure from Settings;
  2. start using a credit card;
  3. fill the form and click on purchase;
  4. when 3DS screen appears, put the app in background;
  5. emulate an Android kill process (run am kill com.braintreepayments.demo in an adb shell, or tap on Terminate Application from logcat in AS);
  6. reopen the app from multitasking pane;
  7. complete 3DS checkout.
  8. crash occurs.

https://user-images.githubusercontent.com/43886303/187188130-bed1649e-21a2-4968-83de-355c33eb904e.mov

Stack trace

2022-08-29 12:55:34.563 8901-8901/com.braintreepayments.demo E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.braintreepayments.demo, PID: 8901
    java.lang.NullPointerException: Attempt to read from field 'java.lang.String com.cardinalcommerce.a.configure.init' on a null object reference
        at com.cardinalcommerce.a.setEditableFactory.init(:2082)
        at com.cardinalcommerce.a.setOnEditorActionListener.Cardinal(:38564)
        at com.cardinalcommerce.a.setOnEditorActionListener$7.onClick(:389)
        at android.view.View.performClick(View.java:7441)
        at android.view.View.performClickInternal(View.java:7418)
        at android.view.View.access$3700(View.java:835)
        at android.view.View$PerformClick.run(View.java:28676)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.app.ActivityThread.main(ActivityThread.java:7839)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
2022-08-29 12:55:34.564 8901-8901/com.braintreepayments.demo E/Exception: Uncaught Exception
    java.lang.NullPointerException: Attempt to read from field 'java.lang.String com.cardinalcommerce.a.configure.init' on a null object reference
        at com.cardinalcommerce.a.setEditableFactory.init(:2082)
        at com.cardinalcommerce.a.setOnEditorActionListener.Cardinal(:38564)
        at com.cardinalcommerce.a.setOnEditorActionListener$7.onClick(:389)
        at android.view.View.performClick(View.java:7441)
        at android.view.View.performClickInternal(View.java:7418)
        at android.view.View.access$3700(View.java:835)
        at android.view.View$PerformClick.run(View.java:28676)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.app.ActivityThread.main(ActivityThread.java:7839)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
2022-08-29 12:55:35.148 8949-8949/com.braintreepayments.demo E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.braintreepayments.demo, PID: 8949
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.braintreepayments.demo/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:3635)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3792)
        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:2210)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.app.ActivityThread.main(ActivityThread.java:7839)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
     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:8051)
        at android.app.Activity.performCreate(Activity.java:8031)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1329)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3608)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3792) 
        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:2210) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loopOnce(Looper.java:201) 
        at android.os.Looper.loop(Looper.java:288) 
        at android.app.ActivityThread.main(ActivityThread.java:7839) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003) 

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:4
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
josephyankscommented, Dec 12, 2022

@sshropshire - at the moment, this accounts for roughly 10% of our crashes (our crash rate is relatively low, but this is definitely a standout). Is there information you’re looking for specifically in regards to overall impact? We’re nervous about any sort of crash related to 3DS since reproduction of the issues seems to be very dependent on the bank.

I will have our product team member reach out to the support team in the meantime - thank you for the link.

0reactions
sshropshirecommented, Dec 12, 2022

Hi @josephyanks thanks for your patience. Cardinal is aware of the issue and has informed us they are working on a fix. Unfortunately we don’t have a firm estimate on when the fix will be available.

Is there additional information you can provide about the overall impact on your application? If you prefer you can submit this to our support team and hopefully we can use this information to further escalate the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG] 3DS2/3DS1 flow is crashing on process death #4167
The 3DS1 / 3DS2 flows will crash if there is a process death - while we use 3DS1/3DS2 flows in our integrations and...
Read more >
Why do my apps keep crashing on Android, How to fix it
Another way to fix apps crashing on your phone is to simply restart the device. Restarting the device will kill and then restart...
Read more >
Defending Your In-Background App When Android OS Kills It
Android OS will kill your app in background to reclaim the resources ... It all started from a crash reported in Firebase Crashlytics...
Read more >
How to Fix Crashing Apps on an iPhone or Android?
I am a developer of iPhone/Android and my app keeps crashing on users ... Kill the App; Restart the Phone; Update the App;...
Read more >
Fast DS Emulator - For Android - Apps on Google Play
Enjoy playing your DS games on your Android device at highest speed. Features: - Play DS games, support files: .nds, .zip ... -...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found