Skip to content
This repository has been archived by the owner on Jun 11, 2021. It is now read-only.

PaymentActivity gets stuck with infinite spinner and "Checking this device..." message #113

Closed
dzmitryl opened this issue Nov 7, 2014 · 22 comments

Comments

@dzmitryl
Copy link

dzmitryl commented Nov 7, 2014

I'm having troubles implementing PayPal integration in Android application using the PayPal Android SDK. If i use sandbox environment when the PaymentActivity is called it just gets stuck showing infinite spinner and "Checking this device" text. However with PayPalConfiguration.ENVIRONMENT_NO_NETWORK it works fine, the problem occurs with the PayPalConfiguration.ENVIRONMENT_SANDBOX. I have a correct Client ID - i tried to copy it into the sample app that is provided with the PayPal SDK and it shows the payment screen with no problems, but my app with the same ID gets stuck on "checking this device".
Can you please advice what to do with this problem? What exactly operations are performed while "Checking this device" message is being shown?
The LOgCat output from the moment PayPalService is launched to the moment PaymentActivity is launched is the following:

11-07 12:12:42.688  24090-24960/com.bodybuilding.debug I/global﹕ In close() at SocketHttpClientConnection
11-07 12:12:42.708  24090-24090/com.bodybuilding.debug I/Adreno200-EGLSUB﹕ <ConfigWindowMatch:1991>: Format RGBA_8888.
11-07 12:12:42.708  24090-24090/com.bodybuilding.debug D/memalloc﹕ ion: Mapped buffer base:0x56ff4000 size:3768320 offset:0 fd:87
11-07 12:12:42.728  24090-24968/com.bodybuilding.debug I/global﹕ In close() at SocketHttpClientConnection
11-07 12:12:42.748  24090-24090/com.bodybuilding.debug D/memalloc﹕ ion: Mapped buffer base:0x5757f000 size:3768320 offset:0 fd:107
11-07 12:12:42.748  24090-24969/com.bodybuilding.debug I/global﹕ In close() at SocketHttpClientConnection
11-07 12:12:42.748  24090-24090/com.bodybuilding.debug D/OpenGLRenderer﹕ Flushing caches (mode 0)
11-07 12:12:42.748  24090-24090/com.bodybuilding.debug D/memalloc﹕ ion: Unmapping buffer  base:0x566ea000 size:3768320
11-07 12:12:42.748  24090-24090/com.bodybuilding.debug D/memalloc﹕ ion: Unmapping buffer  base:0x56a82000 size:3768320
11-07 12:12:42.748  24090-24090/com.bodybuilding.debug D/memalloc﹕ ion: Unmapping buffer  base:0x55464000 size:3768320
11-07 12:12:42.768  24090-24090/com.bodybuilding.debug W/FlurryAgent﹕ Trying to end session
11-07 12:12:42.858  24090-24092/com.bodybuilding.debug D/dalvikvm﹕ GC_CONCURRENT freed 3265K, 75% free 10985K/42339K, paused 3ms+4ms
11-07 12:12:42.868  24090-24971/com.bodybuilding.debug I/global﹕ In close() at SocketHttpClientConnection
11-07 12:12:42.878  24090-24972/com.bodybuilding.debug I/global﹕ In close() at SocketHttpClientConnection
11-07 12:12:42.888  24090-24973/com.bodybuilding.debug I/global﹕ In close() at SocketHttpClientConnection
11-07 12:12:42.898  24090-24974/com.bodybuilding.debug I/global﹕ In close() at SocketHttpClientConnection
11-07 12:12:44.449  24090-24960/com.bodybuilding.debug I/global﹕ In close() at SocketHttpClientConnection
11-07 12:12:44.449  24090-24960/com.bodybuilding.debug I/global﹕ call socket close in SocketHttpClientConnection, socket=SSL socket over Socket[address=/192.168.1.71,port=8889,localPort=33974]
11-07 12:12:44.459  24090-24960/com.bodybuilding.debug I/global﹕ In close() at SocketHttpClientConnection
11-07 12:12:44.580  24090-24974/com.bodybuilding.debug I/global﹕ call socket shutdown in SocketHttpClientConnection, catch exception.
11-07 12:12:44.580  24090-24974/com.bodybuilding.debug I/global﹕ call socket shutdown, tmpsocket=SSL socket over Socket[address=/192.168.1.71,port=8889,localPort=37320], tmpsocket.getSoLinger()=-1
11-07 12:12:45.000  24090-24968/com.bodybuilding.debug I/global﹕ call socket shutdown in SocketHttpClientConnection, catch exception.
11-07 12:12:45.000  24090-24968/com.bodybuilding.debug I/global﹕ call socket shutdown, tmpsocket=SSL socket over Socket[address=/192.168.1.71,port=8889,localPort=60986], tmpsocket.getSoLinger()=-1
11-07 12:12:45.400  24090-24090/com.bodybuilding.debug D/memalloc﹕ ion: Mapped buffer base:0x568c9000 size:3768320 offset:0 fd:114
11-07 12:12:45.440  24090-24973/com.bodybuilding.debug I/global﹕ call socket shutdown in SocketHttpClientConnection, catch exception.
11-07 12:12:45.440  24090-24973/com.bodybuilding.debug I/global﹕ call socket shutdown, tmpsocket=SSL socket over Socket[address=/192.168.1.71,port=8889,localPort=58395], tmpsocket.getSoLinger()=-1
11-07 12:12:45.581  24090-24090/com.bodybuilding.debug I/Adreno200-EGLSUB﹕ <ConfigWindowMatch:1991>: Format RGBA_8888.
11-07 12:12:45.581  24090-24090/com.bodybuilding.debug D/memalloc﹕ ion: Mapped buffer base:0x57917000 size:3768320 offset:0 fd:106
11-07 12:12:45.611  24090-24090/com.bodybuilding.debug D/memalloc﹕ ion: Mapped buffer base:0x57caf000 size:3768320 offset:0 fd:120
11-07 12:12:45.621  24090-24090/com.bodybuilding.debug D/OpenGLRenderer﹕ Flushing caches (mode 0)
11-07 12:12:45.621  24090-24090/com.bodybuilding.debug D/memalloc﹕ ion: Unmapping buffer  base:0x56ff4000 size:3768320
11-07 12:12:45.621  24090-24090/com.bodybuilding.debug D/memalloc﹕ ion: Unmapping buffer  base:0x5757f000 size:3768320
11-07 12:12:45.621  24090-24090/com.bodybuilding.debug D/memalloc﹕ ion: Unmapping buffer  base:0x568c9000 size:3768320
11-07 12:12:45.651  24090-24090/com.bodybuilding.debug D/memalloc﹕ ion: Mapped buffer base:0x567ea000 size:3768320 offset:0 fd:104
11-07 12:12:46.281  24090-24960/com.bodybuilding.debug I/global﹕ call socket shutdown in SocketHttpClientConnection, catch exception.
11-07 12:12:46.281  24090-24960/com.bodybuilding.debug I/global﹕ call socket shutdown, tmpsocket=SSL socket over Socket[address=/192.168.1.71,port=8889,localPort=40842], tmpsocket.getSoLinger()=-1
11-07 12:12:46.902  24090-24972/com.bodybuilding.debug I/global﹕ call socket shutdown in SocketHttpClientConnection, catch exception.
11-07 12:12:46.902  24090-24972/com.bodybuilding.debug I/global﹕ call socket shutdown, tmpsocket=SSL socket over Socket[address=/192.168.1.71,port=8889,localPort=42125], tmpsocket.getSoLinger()=-1
11-07 12:12:47.002  24090-24969/com.bodybuilding.debug I/global﹕ call socket shutdown in SocketHttpClientConnection, catch exception.
11-07 12:12:47.002  24090-24969/com.bodybuilding.debug I/global﹕ call socket shutdown, tmpsocket=SSL socket over Socket[address=/192.168.1.71,port=8889,localPort=54744], tmpsocket.getSoLinger()=-1
@braebot
Copy link
Contributor

braebot commented Nov 7, 2014

Thanks for the report. Can you please provide a few more pieces of information? Specifically:

  • Device model and OS
  • Does this occur for future payments/profile sharing, or single payments?
  • Does this occur in the live environment too?

The logs indicate there are some bad SSL connections, but I'm unable to reproduce it on my end.

@dzmitryl
Copy link
Author

dzmitryl commented Nov 7, 2014

Sure. Here it is.
Device is HTC One X, Android 4.0.3.
This occurs for single payment, immediately after startActivityForResult method is called, activity gets stuck and there is no way to do anything, except going back.
Yes, this occurs for both live and sandbox environments.

@braebot
Copy link
Contributor

braebot commented Nov 7, 2014

Thanks for the info. It's interesting that you note the sample app works, but your app does not. There must be some conflict involved, hence our inability to reproduce it. What's different about your app compared to the sample app? Are you starting your own services? Are there other dependencies? Are you intercepting the network traffic? Have you tried removing/changing various components of your app that differ from the sample app?

To answer one of your original questions, that screen checks the server to see if the client_id and device is valid. This is a server request that either completes successfully and advancing to the next activity, or fails with a dialog and logs.

@dzmitryl
Copy link
Author

dzmitryl commented Nov 7, 2014

Our app is very complex, with several modules, a lot of code and a ton of dependencies.

@braebot
Copy link
Contributor

braebot commented Nov 7, 2014

I figured as much. 😄 We have other reports of this same issue with another partner, so we'll work on trying to isolate the cause. If you make any breakthroughs, please be sure to post them here! Thanks.

@dzmitryl
Copy link
Author

dzmitryl commented Nov 7, 2014

Sure, i'm still trying to figure out what's going on and i will post here in case i have any results.

@dzmitryl
Copy link
Author

Ok, found where problem is. Proguard. PayPalActivity goes through with runProguard=false in gradle file. Should figure how to make them work together.

@braebot
Copy link
Contributor

braebot commented Nov 10, 2014

PayPalActivity goes through with runProguard=false in gradle file

Can you please clarify that a little? Does this only occur for release builds with proguard on?

@dzmitryl
Copy link
Author

Yes, the problem occurs only for builds with proguard on.

@braebot
Copy link
Contributor

braebot commented Nov 10, 2014

Ok, to summarize, the following conditions cause the PaymentActivity to hang for you:

  1. Release build
  2. proguard on
  3. non-mock mode (live or sandbox)

I enabled gradle/proguard builds on our Sample app, but it continues to work fine in both live or sandbox. Are you using the paypal proguard file provided in the sample app?

@dzmitryl
Copy link
Author

With debug build we have the same. We run proguard on debug builds cause due to big number of dependencies we exceed the max number of methods for the app.
I'm using the proguard file that was in our app before i added PayPal. Will try to se what is the difference between them.

@braebot
Copy link
Contributor

braebot commented Nov 10, 2014

Out of curiosity, does card.io work for you? If I remove that section from the sample proguard file, the app no longer has the ability to scan cards. I'm testing other lines to see if I can reproduce the behavior you experience.

@dzmitryl
Copy link
Author

I'm not adding card.io for now. Just manual entry.

@braebot
Copy link
Contributor

braebot commented Nov 10, 2014

I shrunk the proguard file to a bare minimum, but the Sample app still works, minus card.io.

-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

-keepclassmembers class * implements android.os.Parcelable {
    static android.os.Parcelable$Creator CREATOR;
}

-dontwarn com.google.android.gms.**

Just for completeness, which buildToolsVersion, and gradle plugin are you using? Maybe you can email me a copy of your build.gradle file, and/or your proguard file?

@dzmitryl
Copy link
Author

buildToolsVersion 20, com.android.tools.build:gradle:0.12.+
Yes, i can email them to you. What's you email?

@braebot
Copy link
Contributor

braebot commented Nov 10, 2014

I tested using those versions, and everything still works fine in the sample app. Have you thought of upgrading your versions to something more recent? buildToolsVersion is up to 21.1.1, and gradle is at 0.14.2. Feel free to email any files to jbrateman@paypal.com.

@braebot
Copy link
Contributor

braebot commented Dec 11, 2014

We've resolved this issue (after a long time digging). The fix is to replace httpcore and httpclient with httpclient-android in the dependencies. The dependencies should look like the following:

compile ('org.apache.httpcomponents:httpclient-android:4.3.5')
compile ('org.apache.httpcomponents:httpmime:4.3.6') {
    exclude(group: 'org.apache.httpcomponents', module: 'httpclient')
}

@adneerav
Copy link

@braebot

I have added conflict dependency for paypal same like given in documentation (Read ME)
Like below mentioned.

compile ('org.apache.httpcomponents:httpclient-android:4.3.5')
compile ('org.apache.httpcomponents:httpmime:4.3.6') {
    exclude(group: 'org.apache.httpcomponents', module: 'httpclient')
}

But still its getting Stuck with message Checking this device in 4.1.1 devices where in 5.0 & above its working.

  • targetSdkVersion 18
  • compileSdkVersion 23
  • buildToolsVersion '23.0.1'
  • classpath 'com.android.tools.build:gradle:1.5.0'
  • useLibrary 'org.apache.http.legacy'

PayPal SDK : PayPal-Android-SDK 2.13.1

compile 'com.paypal.sdk:paypal-android-sdk:2.13.1'

logcat

02-15 15:26:32.646 19404-19404/com.configureit W/paypal.sdk: PayPalService created. API:16 PayPalSDK/PayPal-Android-SDK 2.13.1 (Android 4.1.1; Genymotion Google Nexus 4 - 4.1.1 - API 16 - 768x1280; )
02-15 15:26:32.678 19404-19404/com.configureit W/paypal.sdk: clearing user data
02-15 15:26:32.702 19404-19404/com.configureit D/dalvikvm: GC_FOR_ALLOC freed 1535K, 9% free 25778K/28103K, paused 14ms, total 15ms
02-15 15:26:32.702 19404-19404/com.configureit I/dalvikvm-heap: Grow heap (frag case) to 25.956MB for 330012-byte allocation
02-15 15:26:32.722 19404-26084/com.configureit D/dalvikvm: GC_FOR_ALLOC freed 440K, 10% free 25660K/28487K, paused 21ms, total 21ms
02-15 15:26:32.794 19404-19404/com.configureit W/EGL_genymotion: eglSurfaceAttrib not implemented
02-15 15:26:32.810 19404-19404/com.configureit D/OpenGLRenderer: TextureCache::get: create texture(0xb91189c8): name, size, mSize = 16904, 9216, 10193820
02-15 15:26:32.814 19404-19404/com.configureit D/OpenGLRenderer: TextureCache::get: create texture(0xb9119bb8): name, size, mSize = 16905, 330000, 10523820
02-15 15:26:32.838 19404-19404/com.configureit D/OpenGLRenderer: TextureCache::callback: name, removed size, mSize = 1638, 9216, 10514604
02-15 15:26:32.838 19404-19404/com.configureit D/OpenGLRenderer: TextureCache::callback: name, removed size, mSize = 1639, 330000, 10184604
02-15 15:26:32.894 19404-19407/com.configureit D/dalvikvm: GC_CONCURRENT freed 1861K, 10% free 25721K/28487K, paused 0ms+1ms, total 16ms
02-15 15:26:32.894 19404-19404/com.configureit D/dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 7ms
02-15 15:26:32.902 19404-19404/com.configureit W/paypal.sdk: active service user data cleared
02-15 15:26:33.858 19404-26086/com.configureit W/paypal.sdk: fv SN:9 PayPal Debug-ID: 12d46460c02c5 [sandbox, 2.13.1;release]
02-15 15:26:37.470 19404-19404/com.configureit I/Choreographer: Skipped 54 frames!  The application may be doing too much work on its main thread.

Please help me for this issue.

@braebot
Copy link
Contributor

braebot commented Feb 16, 2016

When you say "stuck", what is the message you're getting? Are these devices keeping a permanent spinner, or is the app displaying an error message?

@adneerav
Copy link

@braebot

Thanks for the reply :)

When you say "stuck", what is the message you're getting?

Yes devices keeping a permanent spinner.

@NadeemClabs
Copy link

@braebot I am also facing the same issue.

Got this in my logcat

W/paypal.sdk: PayPalService created. API:23 PayPalSDK/PayPal-Android-SDK 2.13.3 (An
W/paypal.sdk: clearing user data
W/paypal.sdk: active service user data cleared
W/paypal.sdk: fv SN:20 PayPal Debug-ID: 107ac19eb979f [live, 2.13.3;release]
W/paypal.sdk: fv SN:23 PayPal Debug-ID: d66d44debb661 [live, 2.13.3;release]

@braebot
Copy link
Contributor

braebot commented Feb 29, 2016

@NadeemClabs, let's track your issue in #264.

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

No branches or pull requests

4 participants