Open Buakenze opened 10 months ago
Hi @Buakenze thanks for using the Braintree SDK for Android. I agree this is strange behavior, but the fact that it's reproducible is promising.
The stack trace references this line in DropInActivity.java. Here, we're looking for an intent extra that contains the original DropInRequest
. This gets set by the SDK when your app calls DropInClient.launchDropIn()
.
The only way I could see this value not being present is if DropInActivity
is launched manually without any intent extras. Is it possible for you to set a breakpoint here in DropInActivityResultContract.java to see if the intent is being created correctly?
Hi @sshropshire, thank you for your reply.
I tried and it appears the intent is created correctly, with my DropInRequest inside.
Only weird thing I noticed is that this method is called twice in quick succession after I call launchDropIn
. The sessionid inside DropInIntentData is the same, so maybe that's intended behavior.
Actually that is a good observation. Is there something in the UI layer that may cause it to launch twice?
I believe there isn't, I confirmed I have only one DropInClient instance and launchDropIn is called only once. What else could cause it to fire twice?
As I stated in the main post I had tried overriding onNewIntent as stated here, but currently that code is commented and I'm getting the same result.
Braintree SDK Version
4.38.2
Environment
Sandbox
Android Version & Device
Samsung Galaxy A34, Android 13
Braintree dependencies
com.braintreepayments.api:drop-in:6.13.0
Describe the bug
Upon returning to app after selecting a paypal payment method I get a NullPointerException:
I found other issues with this error namely #403 and #404 but no solution was given. In my case, it happens everytime.
The crash happens both with an emulator and physical device. I can't understand what I'm doing wrong, it should be a very basic implementation. I have a single activity architecture where I needed the DropInClient inside a fragment, and I even tried moving the logic to the activity to no avail. I am only using the DropInClient, not the BraintreeClient. I also tried overriding onNewIntent as stated here, even though this refers to PayPalClient.
In my activity I have:
I tried fiddling a bit with the intent filters since I read here https://github.com/braintree/braintree-android-drop-in/issues/419#issuecomment-1686825003 that I shouldn't declare it as stated in the documentation (hence the commented part). As for the DropInActivity intent filter, I found it somewhere else in another issue, but can't understand if it's needed or not. I'm still getting the same null pointer either if I declare the intent filter or not. If I declare the intent filter in my activity, I get two choices to get back to the app (duplicated intent filters it seems): one gets me a UserCanceledException, the other gives me the NullPointerException mentioned above.
I'm also getting the same exception with drop in versions 6.10 and 6.12. I upgraded in hope a later version would solve the issue.
Thank you in advance for your attention.
To reproduce
Expected behavior
getting a callback to onDropInSuccess or onDropInFailure
Screenshots
No response