Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to 2.1.0 from 1.2.0 fails in Android #530

Closed
jobypthomas opened this issue Jan 11, 2022 · 12 comments
Closed

Upgrade to 2.1.0 from 1.2.0 fails in Android #530

jobypthomas opened this issue Jan 11, 2022 · 12 comments
Assignees
Labels
Awaiting response Awaiting response from the issuer needs triage Needs triage

Comments

@jobypthomas
Copy link

jobypthomas commented Jan 11, 2022

Describe the bug
Upgrade to 2.1.0 from 1.2.0 along with the recommended changes to build.gradle and the Stripe.instance.initPaymentSheet() and Stripe.instance.presentPaymentSheet() makes the app crash in Android when payment screen is presented.

To Reproduce
Steps to reproduce the behavior:

  1. Upgraded the flutter_stripe from ^1.2.0 to 2.1.0
  2. Changed the build.gradle to implementation 'com.stripe:stripe-android:19.1.0' or implementation 'com.stripe:stripe-android:17.2.0' or kept the current implementation 'com.stripe:stripe-android:16.10.0'
  3. Added the billing details and passed it as a parameter in Stripe.instance.initPaymentSheet()
  4. Updated Stripe.instance.presentPaymentSheet() by removing the parameters: PresentPaymentSheetParameters()
  5. App crashes when calling Stripe.instance.presentPaymentSheet() only when tested by downloading from PlayStore
  6. App DOES NOT crash when tested directly connected to the computer
  7. App DOES NOT crash for iOS version - both directly connected and download from AppStore.

Expected behavior
The payment screen is shown and payment to go through without crashing the app.

Smartphone / tablet

  • Device: [Pixel 3 XL (Android 12) and Android Moto g6 (Android 9)]
  • OS: [Android 12, Android 9]
  • Package version: [2.1.0]
  • Flutter version [2.5.1.]

Additional context
Copy @remonh87

@jobypthomas jobypthomas added the needs triage Needs triage label Jan 11, 2022
@remonh87
Copy link
Member

@jobypthomas I think this has to do with incorrect keys in production mode. I had the same couple of weeks ago and I was still using testkeys in the app and the server was using production keys. Also it can be that you still have testMode to true when using production keys. Let me know if this helps.

If not can you provide me some crash logs?

@jobypthomas
Copy link
Author

jobypthomas commented Jan 11, 2022

@remonh87 Thank you for responding. testMode is false by default. It seems not a key issue as it is working fine in Apple and when device connected directly to the computer. Please note, I am in test setup and not in Production setup with this change. Following is the log from the device (Pixel 3XL):

01-08 15:13:18.955 10303 20739 20739 E AndroidRuntime: java.lang.NoSuchMethodError: No static method asAttributeSet(Ls/d/a/a;)Landroid/util/AttributeSet; in class Landroid/util/Xml; or its super classes (declaration of 'android.util.Xml' appears in /system/framework/framework.jar!classes3.dex)
01-08 15:13:18.955 10303 20739 20739 E AndroidRuntime: at i.a.n.g.inflate(Unknown Source:21)
01-08 15:13:18.955 10303 20739 20739 E AndroidRuntime: at com.stripe.android.paymentsheet.BasePaymentMethodsListFragment.onCreateOptionsMenu(Unknown Source:12)
01-08 15:13:18.955 10303 20739 20739 E AndroidRuntime: at androidx.fragment.app.Fragment.performCreateOptionsMenu(Unknown Source:14)
01-08 15:13:18.955 10303 20739 20739 E AndroidRuntime: at androidx.fragment.app.m.a(Unknown Source:39)
01-08 15:13:18.955 10303 20739 20739 E AndroidRuntime: at androidx.fragment.app.h.a(Unknown Source:4)
01-08 15:13:18.955 10303 20739 20739 E AndroidRuntime: at androidx.fragment.app.e.onCreatePanelMenu(Unknown Source:12)
01-08 15:13:18.955 10303 20739 20739 E AndroidRuntime: at i.a.n.i.onCreatePanelMenu(Unknown Source:2)
01-08 15:13:18.955 10303 20739 20739 E AndroidRuntime: at androidx.appcompat.app.h$o.onCreatePanelMenu(Unknown Source:8)
01-08 15:13:18.955 10303 20739 20739 E AndroidRuntime: at i.a.n.i.onCreatePanelMenu(Unknown Source:2)
01-08 15:13:18.955 10303 20739 20739 E AndroidRuntime: at androidx.appcompat.app.m.m(Unknown Source:25)
01-08 15:13:18.955 10303 20739 20739 E AndroidRuntime: at androidx.appcompat.app.m$a.run(Unknown Source:2)
01-08 15:13:18.955 10303 20739 20739 E AndroidRuntime: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1037)
01-08 15:13:18.955 10303 20739 20739 E AndroidRuntime: at android.view.Choreographer.doCallbacks(Choreographer.java:845)
01-08 15:13:18.955 10303 20739 20739 E AndroidRuntime: at android.view.Choreographer.doFrame(Choreographer.java:775)
01-08 15:13:18.955 10303 20739 20739 E AndroidRuntime: at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1022)
01-08 15:13:18.955 10303 20739 20739 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:938)
01-08 15:13:18.955 10303 20739 20739 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99)
01-08 15:13:18.955 10303 20739 20739 E AndroidRuntime: at android.os.Looper.loopOnce(Looper.java:201)
01-08 15:13:18.955 10303 20739 20739 E AndroidRuntime: at android.os.Looper.loop(Looper.java:288)
01-08 15:13:18.955 10303 20739 20739 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7842)
01-08 15:13:18.955 10303 20739 20739 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
01-08 15:13:18.955 10303 20739 20739 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
01-08 15:13:18.955 10303 20739 20739 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
01-08 15:13:38.935 10303 21412 21412 E AndroidRuntime: FATAL EXCEPTION: main

@jobypthomas
Copy link
Author

@remonh87
From another device - Moto G6 (Android 9 ):

01-08 08:12:33.980 10266 20064 20064 E AndroidRuntime: java.lang.NoSuchMethodError: No static method asAttributeSet(Ls/d/a/a;)Landroid/util/AttributeSet; in class Landroid/util/Xml; or its super classes (declaration of 'android.util.Xml' appears in /system/framework/framework.jar!classes2.dex)
01-08 08:12:33.980 10266 20064 20064 E AndroidRuntime: at i.a.n.g.inflate(Unknown Source:21)
01-08 08:12:33.980 10266 20064 20064 E AndroidRuntime: at com.stripe.android.paymentsheet.BasePaymentMethodsListFragment.onCreateOptionsMenu(Unknown Source:12)
01-08 08:12:33.980 10266 20064 20064 E AndroidRuntime: at androidx.fragment.app.Fragment.performCreateOptionsMenu(Unknown Source:14)
01-08 08:12:33.980 10266 20064 20064 E AndroidRuntime: at androidx.fragment.app.m.a(Unknown Source:39)
01-08 08:12:33.980 10266 20064 20064 E AndroidRuntime: at androidx.fragment.app.h.a(Unknown Source:4)
01-08 08:12:33.980 10266 20064 20064 E AndroidRuntime: at androidx.fragment.app.e.onCreatePanelMenu(Unknown Source:12)
01-08 08:12:33.980 10266 20064 20064 E AndroidRuntime: at i.a.n.i.onCreatePanelMenu(Unknown Source:2)
01-08 08:12:33.980 10266 20064 20064 E AndroidRuntime: at androidx.appcompat.app.h$o.onCreatePanelMenu(Unknown Source:8)
01-08 08:12:33.980 10266 20064 20064 E AndroidRuntime: at i.a.n.i.onCreatePanelMenu(Unknown Source:2)
01-08 08:12:33.980 10266 20064 20064 E AndroidRuntime: at androidx.appcompat.app.m.m(Unknown Source:25)
01-08 08:12:33.980 10266 20064 20064 E AndroidRuntime: at androidx.appcompat.app.m$a.run(Unknown Source:2)
01-08 08:12:33.980 10266 20064 20064 E AndroidRuntime: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:949)
01-08 08:12:33.980 10266 20064 20064 E AndroidRuntime: at android.view.Choreographer.doCallbacks(Choreographer.java:761)
01-08 08:12:33.980 10266 20064 20064 E AndroidRuntime: at android.view.Choreographer.doFrame(Choreographer.java:693)
01-08 08:12:33.980 10266 20064 20064 E AndroidRuntime: at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:935)
01-08 08:12:33.980 10266 20064 20064 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:873)
01-08 08:12:33.980 10266 20064 20064 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99)
01-08 08:12:33.980 10266 20064 20064 E AndroidRuntime: at android.os.Looper.loop(Looper.java:215)
01-08 08:12:33.980 10266 20064 20064 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6939)
01-08 08:12:33.980 10266 20064 20064 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
01-08 08:12:33.980 10266 20064 20064 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
01-08 08:12:33.980 10266 20064 20064 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:870)
01-08 08:27:39.004 1047 3256 24091 F libc : FORTIFY: pthread_mutex_lock called on a destroyed mutex (0xae324e30)
01-08 08:27:39.022 1047 3256 24091 F libc : Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 24091 (cam_data_proc), pid 3256 (provider@2.4-se)
01-08 08:27:39.172 1047 24150 24150 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
01-08 08:27:39.173 1047 24150 24150 F DEBUG : Build fingerprint: 'motorola/ali_trac/ali:9/PPS29.118-15-11-16/3afd9:user/release-keys'
01-08 08:27:39.173 1047 24150 24150 F DEBUG : Revision: 'PVT2'
01-08 08:27:39.173 1047 24150 24150 F DEBUG : ABI: 'arm'
01-08 08:27:39.173 1047 24150 24150 F DEBUG : pid: 3256, tid: 24091, name: cam_data_proc >>> /vendor/bin/hw/motorola.hardware.camera.provider@2.4-service <<<
01-08 08:27:39.173 1047 24150 24150 F DEBUG : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
01-08 08:27:39.173 1047 24150 24150 F DEBUG : Abort message: 'FORTIFY: pthread_mutex_lock called on a destroyed mutex (0xae324e30)'
01-08 08:27:39.173 1047 24150 24150 F DEBUG : r0 00000000 r1 00005e1b r2 00000006 r3 00000008
01-08 08:27:39.173 1047 24150 24150 F DEBUG : r4 00000cb8 r5 00005e1b r6 b0eea824 r7 0000010c
01-08 08:27:39.173 1047 24150 24150 F DEBUG : r8 b0eea8cc r9 b3be8400 r10 b2f0a600 r11 ae327030
01-08 08:27:39.173 1047 24150 24150 F DEBUG : ip b2fb9000 sp b0eea810 lr b4331e79 pc b4329cb6
01-08 08:27:39.187 1047 24150 24150 F DEBUG :
01-08 08:27:39.187 1047 24150 24150 F DEBUG : backtrace:
01-08 08:27:39.187 1047 24150 24150 F DEBUG : #00 pc 0001ccb6 /system/lib/libc.so (abort+58)
01-08 08:27:39.187 1047 24150 24150 F DEBUG : #1 pc 00064523 /system/lib/libc.so (__fortify_fatal(char const*, ...)+26)
01-08 08:27:39.187 1047 24150 24150 F DEBUG : #2 pc 00063d25 /system/lib/libc.so (HandleUsingDestroyedMutex(pthread_mutex_t*, char const*)+20)
01-08 08:27:39.187 1047 24150 24150 F DEBUG : #3 pc 00063c53 /system/lib/libc.so (pthread_mutex_lock+214)
01-08 08:27:39.187 1047 24150 24150 F DEBUG : #4 pc 0008180d /vendor/lib/hw/camera.msm8953.so (qcamera::QCamera3StreamMem::cleanInvalidateCache(unsigned int)+12)
01-08 08:27:39.187 1047 24150 24150 F DEBUG : #5 pc 0007f8e9 /vendor/lib/hw/camera.msm8953.so (qcamera::QCamera3PostProcessor::encodeData(qcamera::qcamera_hal3_jpeg_data_t*, unsigned char&)+324)
01-08 08:27:39.187 1047 24150 24150 F DEBUG : #6 pc 0007c00b /vendor/lib/hw/camera.msm8953.so (qcamera::QCamera3PostProcessor::dataProcessRoutine(void*)+1102)
01-08 08:27:39.187 1047 24150 24150 F DEBUG : #7 pc 000632b5 /system/lib/libc.so (__pthread_start(void*)+22)
01-08 08:27:39.187 1047 24150 24150 F DEBUG : #8 pc 0001de79 /system/lib/libc.so (__start_thread+24)
01-08 08:27:58.901 1047 24170 24378 F libc : FORTIFY: pthread_mutex_lock called on a destroyed mutex (0xacdfce30)
01-08 08:27:58.902 1047 24170 24378 F libc : Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 24378 (cam_data_proc), pid 24170 (provider@2.4-se)
01-08 08:27:58.973 1047 24536 24536 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
01-08 08:27:58.974 1047 24536 24536 F DEBUG : Build fingerprint: 'motorola/ali_trac/ali:9/PPS29.118-15-11-16/3afd9:user/release-keys'
01-08 08:27:58.974 1047 24536 24536 F DEBUG : Revision: 'PVT2'
01-08 08:27:58.974 1047 24536 24536 F DEBUG : ABI: 'arm'
01-08 08:27:58.974 1047 24536 24536 F DEBUG : pid: 24170, tid: 24378, name: cam_data_proc >>> /vendor/bin/hw/motorola.hardware.camera.provider@2.4-service <<<
01-08 08:27:58.974 1047 24536 24536 F DEBUG : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
01-08 08:27:58.974 1047 24536 24536 F DEBUG : Abort message: 'FORTIFY: pthread_mutex_lock called on a destroyed mutex (0xacdfce30)'
01-08 08:27:58.974 1047 24536 24536 F DEBUG : r0 00000000 r1 00005f3a r2 00000006 r3 00000008
01-08 08:27:58.974 1047 24536 24536 F DEBUG : r4 00005e6a r5 00005f3a r6 abd69824 r7 0000010c
01-08 08:27:58.974 1047 24536 24536 F DEBUG : r8 abd698cc r9 acdf9000 r10 acd8a330 r11 acdde030
01-08 08:27:58.974 1047 24536 24536 F DEBUG : ip ac2f8000 sp abd69810 lr ae2ace79 pc ae2a4cb6
01-08 08:27:58.985 1047 24536 24536 F DEBUG :
01-08 08:27:58.985 1047 24536 24536 F DEBUG : backtrace:
01-08 08:27:58.985 1047 24536 24536 F DEBUG : #00 pc 0001ccb6 /system/lib/libc.so (abort+58)
01-08 08:27:58.985 1047 24536 24536 F DEBUG : #1 pc 00064523 /system/lib/libc.so (__fortify_fatal(char const*, ...)+26)
01-08 08:27:58.985 1047 24536 24536 F DEBUG : #2 pc 00063d25 /system/lib/libc.so (HandleUsingDestroyedMutex(pthread_mutex_t*, char const*)+20)
01-08 08:27:58.985 1047 24536 24536 F DEBUG : #3 pc 00063c53 /system/lib/libc.so (pthread_mutex_lock+214)
01-08 08:27:58.985 1047 24536 24536 F DEBUG : #4 pc 0008180d /vendor/lib/hw/camera.msm8953.so (qcamera::QCamera3StreamMem::cleanInvalidateCache(unsigned int)+12)
01-08 08:27:58.985 1047 24536 24536 F DEBUG : #5 pc 0007f8e9 /vendor/lib/hw/camera.msm8953.so (qcamera::QCamera3PostProcessor::encodeData(qcamera::qcamera_hal3_jpeg_data_t*, unsigned char&)+324)
01-08 08:27:58.985 1047 24536 24536 F DEBUG : #6 pc 0007c00b /vendor/lib/hw/camera.msm8953.so (qcamera::QCamera3PostProcessor::dataProcessRoutine(void*)+1102)
01-08 08:27:58.985 1047 24536 24536 F DEBUG : #7 pc 000632b5 /system/lib/libc.so (__pthread_start(void*)+22)
01-08 08:27:58.985 1047 24536 24536 F DEBUG : #8 pc 0001de79 /system/lib/libc.so (__start_thread+24)

@jobypthomas
Copy link
Author

Found something similar - jonasbark/flutter_stripe_payment#257 I am going to try it out.

@jobypthomas
Copy link
Author

@jonasbark @remonh87 Did NOT resolve with the fix for jonasbark/flutter_stripe_payment#257. I see that the error is different - java.lang.NoSuchMethodError: No static method asAttributeSet(Ls/d/a/a;)Landroid/util/AttributeSet; in class Landroid/util/Xml; or its super classes (declaration of 'android.util.Xml' appears in /system/framework/framework.jar!classes2.dex)

@jamesblasco
Copy link
Member

Could you remove the implementation 'com.stripe:stripe-android:19.1.0'.

The plugin itself already adds its own version here:

implementation 'com.stripe:stripe-android:18.1.0'

@jamesblasco jamesblasco self-assigned this Jan 15, 2022
@jamesblasco jamesblasco added the Awaiting response Awaiting response from the issuer label Jan 15, 2022
@jobypthomas
Copy link
Author

jobypthomas commented Jan 15, 2022

@jamesblasco Thank you for your help!
No Luck with removing the implementation. To confirm, following are the only two changes which are android (iOS works just fine) specific:
build.gradle:

dependencies {
...
  implementation 'com.google.android.gms:play-services-wallet:18.1.3'
// implementation 'com.stripe:stripe-android:16.10.0'
...
}

AndroidManifest.xml

<activity..>
<meta-data
              android:name="com.google.android.gms.wallet.api.enabled"
              android:value="true" 
/>
</activity>

Thanks!

@jamesblasco
Copy link
Member

Could you try this:

https://stackoverflow.com/a/60631550/8096916

I feel the issue is related to google pay in some way

@jamesblasco
Copy link
Member

And if possible update wallet to 'com.google.android.gms:play-services-wallet:19.0.1' and do a clean of the android project in android studio.

Let's see if that solve it

@jobypthomas
Copy link
Author

@jamesblasco I've updated to com.google.android.gms:play-services-wallet:19.0.1 but no luck!

@jamesblasco
Copy link
Member

What about changing the recommendation of the proguard rules from the link I shared above?
https://stackoverflow.com/a/60631550/8096916

@jobypthomas
Copy link
Author

@jamesblasco Yes, it worked. I am not an android developer and I did not have proguard-rules.pro in my setup so I had to setup the proguard to make it work. Many Thanks for your guidance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting response Awaiting response from the issuer needs triage Needs triage
Projects
None yet
Development

No branches or pull requests

4 participants