Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash in BraintreeFragment after updating version from 3.12.0 to 3.13.0 #308

Closed
hakanbagci opened this issue Aug 24, 2020 · 3 comments
Closed

Comments

@hakanbagci
Copy link

hakanbagci commented Aug 24, 2020

General Information

  • SDK/Library version: Android SDK 3.13.0
  • Environment: Production
  • Android Version and Device: All Android versions with various devices
  • Braintree dependencies: com.braintreepayments.api:braintree:3.13.0

Min SDK Version: 21

Issue description

After updating braintree Android SDK version from 3.12.0 to 3.13.0 we have started observing following exception in our crash logs which are related to BraintreeFragment. I think it is happening because activity is becoming null in some certain cases.

This crash is infrequent but we are observing it with significant numbers. BTW, it started immediately after updating version from 3.12.0 to 3.13.0.

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.app.Activity.getApplicationContext()' on a null object reference
       at com.braintreepayments.api.BraintreeFragment.getReturnUrlScheme(BraintreeFragment.java:390)
       at com.braintreepayments.api.PayPal.populateRequestData(PayPal.java:513)
       at com.braintreepayments.api.PayPal.getCheckoutRequest(PayPal.java:459)
       at com.braintreepayments.api.PayPal$1.success(PayPal.java:171)
       at com.braintreepayments.api.internal.HttpClient$3.run(HttpClient.java:288)
       at android.os.Handler.handleCallback(Handler.java:888)
       at android.os.Handler.dispatchMessage(Handler.java:100)
       at android.os.Looper.loop(Looper.java:213)
       at android.app.ActivityThread.main(ActivityThread.java:8178)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101)

It seems that it is caused by the change done in new version (3.13.0). Here is the link to the changed method that causes the issue.

@sshropshire
Copy link
Contributor

Hi @hakanbagci thanks for using the Braintree SDK for Android. We see the issue, and we're working on a fix.

It seems like this could occur when the BraintreeFragment is no longer attached to an Activity. Out of curiosity, were you able to reproduce this with a consistent set of steps?

@hakanbagci
Copy link
Author

Hi @sshropshire, thanks for the quick response. This crash is happening rarely and unfortunately, we were not able to reproduce it. One more insight about the crash is that devices are always in the foreground.

@braintree braintree deleted a comment from darkmode-cyber Aug 25, 2020
@sshropshire
Copy link
Contributor

Hi @hakanbagci we provided a fix for this issue in or latest v3.14.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants