Taracque / cordova-plugin-braintree

:credit_card: A Cordova plugin for the Braintree mobile payment processing SDK.
MIT License
27 stars 42 forks source link

NoClassDefFound Error on Android #39

Closed jamesdixon closed 7 years ago

jamesdixon commented 7 years ago

Some of my customers are seeing the app crash when trying to add a payment method on Android. This is the error I'm seeing:


Exception java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/wallet/Wallet;
com.braintreepayments.api.BraintreeFragment.getGoogleApiClient (BraintreeFragment.java:749)
com.braintreepayments.api.BraintreeFragment$12.onConfigurationFetched (BraintreeFragment.java:734)
com.braintreepayments.api.BraintreeFragment$11.run (BraintreeFragment.java:683)
com.braintreepayments.api.BraintreeFragment.postOrQueueCallback (BraintreeFragment.java:607)
com.braintreepayments.api.BraintreeFragment.waitForConfiguration (BraintreeFragment.java:675)
com.braintreepayments.api.BraintreeFragment.getGoogleApiClient (BraintreeFragment.java:731)
com.braintreepayments.api.AndroidPay$1.onConfigurationFetched (AndroidPay.java:87)
com.braintreepayments.api.BraintreeFragment$11.run (BraintreeFragment.java:683)
com.braintreepayments.api.BraintreeFragment.postOrQueueCallback (BraintreeFragment.java:607)
com.braintreepayments.api.BraintreeFragment.waitForConfiguration (BraintreeFragment.java:675)
com.braintreepayments.api.AndroidPay.isReadyToPay (AndroidPay.java:79)
com.braintreepayments.api.dropin.DropInActivity.onConfigurationFetched (DropInActivity.java:149)
com.braintreepayments.api.BraintreeFragment$2.run (BraintreeFragment.java:500)
com.braintreepayments.api.BraintreeFragment.postOrQueueCallback (BraintreeFragment.java:607)
com.braintreepayments.api.BraintreeFragment.postConfigurationCallback (BraintreeFragment.java:492)
com.braintreepayments.api.BraintreeFragment$9.onConfigurationFetched (BraintreeFragment.java:642)
com.braintreepayments.api.ConfigurationManager$1.success (ConfigurationManager.java:68)
com.braintreepayments.api.internal.HttpClient$3.run (HttpClient.java:286)
android.os.Handler.handleCallback (Handler.java:751)
android.os.Handler.dispatchMessage (Handler.java:95)
android.os.Looper.loop (Looper.java:154)
android.app.ActivityThread.main (ActivityThread.java:6682)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1520)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1410)
arrow_drop_down
Caused by java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.wallet.Wallet" on path: DexPathList[[zip file "/data/app/com.scoutforpets.customer-1/base.apk"],nativeLibraryDirectories=[/data/app/com.scoutforpets.customer-1/lib/arm, /data/app/com.scoutforpets.customer-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]

Any idea what this might be?

adamfellon commented 7 years ago

Did you find a solution to this? Ran into a similar issue and played with a few things (updated the api version in build-extras.gradle) but that didn't help.

Thanks!

jamesdixon commented 7 years ago

@adamfellon well, this issue has been a real killer for me because I haven't been able to reproduce it myself. That said, I added the following to build-gradles.extra and haven't seen any of these crashes in over a week.

dependencies {
    compile "com.google.android.gms:play-services-wallet:+"
}
adamfellon commented 7 years ago

That looks like it works for me! @Taracque Looks like they forgot an import or something over at Braintree. Think this commit ( https://github.com/braintree/braintree_android/commit/2c3d9ad9db68fa36e8290c979af6a809b451a865 ) fixes handling this error likely, so i'll hold off on a pr to add the dependcy.

jamesdixon commented 7 years ago

@adamfellon glad to hear it and nice find!