braintree / braintree-android-drop-in

Braintree Drop-In SDK for Android
https://developers.braintreepayments.com/guides/drop-in/android/v2
MIT License
125 stars 79 forks source link

NullPointerException #228

Closed chornomor closed 3 years ago

chornomor commented 3 years ago

General information

Issue description

I see this crash on Crashlytics I create DropInRequest by this code: DropInRequest dropInRequest = new DropInRequest().cardholderNameStatus(CardForm.FIELD_REQUIRED) .disablePayPal() .clientToken(stringControllerResponse);

And Intent to start DropInActivity i get from dropInRequest. activity.startActivityForResult(dropInRequest.getIntent(activity), PaymentMethodService.REQUEST_BRAINTREE);

And therefore it is very strange that in DropInActivity dropInRequest is null, although the intent is taken from the same dropInRequest.

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.driivz.mobile.android.evgo.driver/com.braintreepayments.api.dropin.DropInActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.braintreepayments.api.dropin.DropInRequest.g()' on a null object reference at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726) at android.app.ActivityThread.-wrap12(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6119) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:107)

Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.braintreepayments.api.dropin.DropInRequest.g()' on a null object reference at com.braintreepayments.api.dropin.BaseActivity.getBraintreeFragment(BaseActivity.java:50) at com.braintreepayments.api.dropin.DropInActivity.onCreate(DropInActivity.java:110) at android.app.Activity.performCreate(Activity.java:6679) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726) at android.app.ActivityThread.-wrap12(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6119) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:107)

sestevens commented 3 years ago

Hi @chornomor, have you been able to reproduce this crash or are you only observing it in Crashlytics? If you have steps to reproduce this issue, that would be helpful.

I'm also curious how frequently you're seeing this crash and if there are any patterns in terms of device and Android version. You mentioned that it's occurring on Nexus 6 and Android 7. Does it occur on ALL devices that match those specs? Does it occur on any other devices or Android versions?

chornomor commented 3 years ago

Hi @sestevens, I gave out all the information available. Unfortunately, there are no steps to reproduction, I met this crash only in Crashlytics. The crash happened only twice, two users and all had Nexus 6 and Android 7.1.1. This is all the information that is so far. As soon as additional information appears, I will definitely share. I'm also interested in this))

AnastasiyaVia commented 3 years ago

Have the same issue. Also only crashlytics Happened few different devices : Android 9 Pixel 3a Any update on this one?

sshropshire commented 3 years ago

@AnastasiyaVia unfortunately without steps to reproduce it's hard to diagnose the issue. It appears the DropInRequest is somehow not being parsed in onCreate. We'll look into this, it seems that this can be common in Android.