Reputation: 51
I'm using Braintree SDK for PayPal integration in my native android app. I'm using my Custom UI for entering the Card Details. Once the card Details are entered. SDK call for card.tokenize
is called.
BraintreeFragment mBraintreeFragment;
try {
mBraintreeFragment = BraintreeFragment.newInstance( MainActivity.this, btToken);
Card.tokenize(mBraintreeFragment, cardBuilder);
Log.i("TAG", "getTokenized Card TRY::");
} catch (Exception e) {
Log.i("TAG", "exception Card");
Log.i("TAG", "Exception" + e);
}
mBraintreeFragment = BraintreeFragment.newInstance( MainActivity.this, btToken);
is throwing error on trying to tokenie.
error thrown is ::: java.lang.NoSuchMethodError: No static method newInstance(Landroidx/appcompat/app/AppCompatActivity;Ljava/lang/String;)Lcom/braintreepayments/api/BraintreeFragment; in class Lcom/braintreepayments/api/BraintreeFragment; or its super classes (declaration of 'com.braintreepayments.api.BraintreeFragment' appears in /data/app/com.ust.fcs.wiwo-Eg4iuAwmHl6_q2RzdgkwGA==/base.apk) at com.ust.fcs.braintreesdklib.activities.MainActivity.getBraintreeDeviceData(MainActivity.java:549)
. please suggest me a work around for it.
Upvotes: 0
Views: 441
Reputation: 51
This was due to the implementation of Baintree dependencies, I have updated to :
implementation 'com.braintreepayments.api:braintree:3.14.0' implementation 'com.braintreepayments.api:drop-in:4.6.0'
, which solves
the above issue.
Upvotes: 0
Reputation: 2706
MainActivity should extends AppCompatActivity starting from Braintree SDK v3 ("v2" is deprecated now).
Reference: https://developers.braintreepayments.com/guides/client-sdk/migration/android/v2
Upvotes: 0