stripe-react-native
stripe-react-native copied to clipboard
app crashes when calling presentPaymentSheet for android with android v10
Describe the bug Since this week we are experiencing for our android users that their app is crashing when triggering presentPaymentSheet. We have figured out that the error only happens for users which uses android devices with android v10.
To Reproduce Steps to reproduce the behavior:
- Trigger "presentPaymentSheet"
- Sheet is visible very short, you ionly see the half sheet, then crash (see below the crash report)
Expected behavior No crash
Screenshots N/A
Smartphone:
- Device: Samsung & Huawei p30 pro
- OS: Android 10
- Browser [e.g. stock browser, safari]
- Version: "@stripe/stripe-react-native": "^0.35.0"
Android build.gradle:
buildscript {
ext {
buildToolsVersion = "33.0.0"
minSdkVersion = 21
compileSdkVersion = 33
targetSdkVersion = 33
// We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
ndkVersion = "23.1.7779620"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle")
classpath("com.facebook.react:react-native-gradle-plugin")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:4.4.0'
classpath("com.google.firebase:firebase-crashlytics-gradle:2.9.2")
classpath("com.google.firebase:perf-plugin:1.4.2")
}
}
Crashlytics - Stack trace
Application: ****** Platform: android Version: 1.2.1 (46) Issue: f33619d8a962919287c386db9f0d42dd Session: 657B2DCA025700014EEB25210E5E4FC9_DNE_0_v2 Date: Thu Dec 14 2023 17:31:40 GMT+0100 (Mitteleuropäische Normalzeit)
Fatal Exception: java.lang.SecurityException: Unknown calling package name 'com.google.android.gms'.
at android.os.Parcel.createException(Parcel.java:2088)
at android.os.Parcel.readException(Parcel.java:2056)
at android.os.Parcel.readException(Parcel.java:2004)
at m.azz.q(:com.google.android.gms.dynamite_dynamitemodulesc@[email protected] (100400-0):172)
at m.azw.a(:com.google.android.gms.dynamite_dynamitemodulesc@[email protected] (100400-0):14)
at m.azy.c(:com.google.android.gms.dynamite_dynamitemodulesc@[email protected] (100400-0):7)
at m.azr.d(:com.google.android.gms.dynamite_dynamitemodulesc@[email protected] (100400-0):7)
at m.azs.handleMessage(:com.google.android.gms.dynamite_dynamitemodulesc@[email protected] (100400-0):281)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:7762)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1047)
Thread-9:
at com.facebook.jni.NativeRunnable.run(NativeRunnable.java)
at java.lang.Thread.run(Thread.java:919)
OkHttp Dispatcher:
at sun.misc.Unsafe.park(Unsafe.java)
at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:230)
at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:461)
at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:362)
at java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:937)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1091)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
pool-8-thread-1:
at sun.misc.Unsafe.park(Unsafe.java)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:190)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2067)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1092)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
Thread-10:
at com.facebook.jni.NativeRunnable.run(NativeRunnable.java)
at java.lang.Thread.run(Thread.java:919)
FrescoDecodeExecutor-7:
at sun.misc.Unsafe.park(Unsafe.java)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:190)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2067)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1092)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.facebook.imagepipeline.core.PriorityThreadFactory$1.run(PriorityThreadFactory.java:52)
at java.lang.Thread.run(Thread.java:919)
OkHttp play.google.com:
at com.android.org.conscrypt.NativeCrypto.SSL_read(NativeCrypto.java)
at com.android.org.conscrypt.NativeSsl.read(NativeSsl.java:411)
at com.android.org.conscrypt.ConscryptFileDescriptorSocket$SSLInputStream.read(ConscryptFileDescriptorSocket.java:583)
at okio.InputStreamSource.read(JvmOkio.kt:91)
at okio.AsyncTimeout$source$1.read(AsyncTimeout.kt:129)
at okio.RealBufferedSource.request(RealBufferedSource.kt:206)
at okio.RealBufferedSource.require(RealBufferedSource.kt:199)
at okhttp3.internal.http2.Http2Reader.nextFrame(Http2Reader.kt:89)
at okhttp3.internal.http2.Http2Connection$ReaderRunnable.invoke(Http2Connection.kt:618)
at okhttp3.internal.http2.Http2Connection$ReaderRunnable.invoke(Http2Connection.kt:609)
at okhttp3.internal.concurrent.TaskQueue$execute$1.runOnce(TaskQueue.kt:98)
at okhttp3.internal.concurrent.TaskRunner.runTask(TaskRunner.kt:116)
at okhttp3.internal.concurrent.TaskRunner.access$runTask(TaskRunner.kt:42)
at okhttp3.internal.concurrent.TaskRunner$runnable$1.run(TaskRunner.kt:65)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
FrescoDecodeExecutor-3:
at sun.misc.Unsafe.park(Unsafe.java)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:190)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2067)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1092)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.facebook.imagepipeline.core.PriorityThreadFactory$1.run(PriorityThreadFactory.java:52)
at java.lang.Thread.run(Thread.java:919)
pool-5-thread-1:
at sun.misc.Unsafe.park(Unsafe.java)
at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:230)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2109)
at java.util.concurrent.LinkedBlockingQueue.poll(LinkedBlockingQueue.java:467)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1091)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
OkHttp Dispatcher:
at sun.misc.Unsafe.park(Unsafe.java)
at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:230)
at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:461)
at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:362)
at java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:937)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1091)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
Firebase Blocking Thread #0:
at sun.misc.Unsafe.park(Unsafe.java)
at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:230)
at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:461)
at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:362)
at java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:937)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1091)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.google.firebase.concurrent.CustomThreadFactory.lambda$newThread$0$com-google-firebase-concurrent-CustomThreadFactory(CustomThreadFactory.java:47)
at com.google.firebase.concurrent.CustomThreadFactory$$ExternalSyntheticLambda0.run(:4)
at java.lang.Thread.run(Thread.java:919)
Okio Watchdog:
at java.lang.Object.wait(Object.java)
at java.lang.Object.wait(Object.java:442)
at okio.AsyncTimeout$Companion.awaitTimeout$okio(AsyncTimeout.kt:300)
at okio.AsyncTimeout$Watchdog.run(AsyncTimeout.kt:187)
DefaultDispatcher-worker-5:
at sun.misc.Unsafe.park(Unsafe.java)
at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:353)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.park(CoroutineScheduler.kt:795)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.tryPark(CoroutineScheduler.kt:740)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:711)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
OkHttp ConnectionPool:
at java.lang.Object.wait(Object.java)
at com.android.okhttp.ConnectionPool$1.run(ConnectionPool.java:106)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
OkHttp Dispatcher:
at sun.misc.Unsafe.park(Unsafe.java)
at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:230)
at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:461)
at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:362)
at java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:937)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1091)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
GmsDynamite:
at java.lang.Object.wait(Object.java)
at java.lang.Object.wait(Object.java:442)
at java.lang.Object.wait(Object.java:568)
at com.google.android.gms.dynamite.zza.run(com.google.android.gms:play-services-basement@@18.2.0:2)
AsyncTask #3:
at sun.misc.Unsafe.park(Unsafe.java)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:190)
at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:459)
at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:362)
at java.util.concurrent.SynchronousQueue.take(SynchronousQueue.java:920)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1092)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
OkHttp Dispatcher:
at sun.misc.Unsafe.park(Unsafe.java)
at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:230)
at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:461)
at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:362)
at java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:937)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1091)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
FrameMetricsAggregator:
at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
at android.os.MessageQueue.next(MessageQueue.java:336)
at android.os.Looper.loop(Looper.java:197)
at android.os.HandlerThread.run(HandlerThread.java:67)
FrescoLightWeightBackgroundExecutor-1:
at sun.misc.Unsafe.park(Unsafe.java)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:190)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2067)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1092)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.facebook.imagepipeline.core.PriorityThreadFactory$1.run(PriorityThreadFactory.java:52)
at java.lang.Thread.run(Thread.java:919)
Crashlytics Exception Handler1:
at dalvik.system.VMStack.getThreadStackTrace(VMStack.java)
at java.lang.Thread.getStackTrace(Thread.java:1720)
at java.lang.Thread.getAllStackTraces(Thread.java:1796)
at com.google.firebase.crashlytics.internal.common.CrashlyticsReportDataCapture.populateThreadsList(CrashlyticsReportDataCapture.java:336)
at com.google.firebase.crashlytics.internal.common.CrashlyticsReportDataCapture.populateExecutionData(CrashlyticsReportDataCapture.java:307)
at com.google.firebase.crashlytics.internal.common.CrashlyticsReportDataCapture.populateEventApplicationData(CrashlyticsReportDataCapture.java:255)
at com.google.firebase.crashlytics.internal.common.CrashlyticsReportDataCapture.captureEventData(CrashlyticsReportDataCapture.java:108)
at com.google.firebase.crashlytics.internal.common.SessionReportingCoordinator.persistEvent(SessionReportingCoordinator.java:303)
at com.google.firebase.crashlytics.internal.common.SessionReportingCoordinator.persistFatalEvent(SessionReportingCoordinator.java:132)
at com.google.firebase.crashlytics.internal.common.CrashlyticsController$2.call(CrashlyticsController.java:214)
at com.google.firebase.crashlytics.internal.common.CrashlyticsController$2.call(CrashlyticsController.java:199)
at com.google.firebase.crashlytics.internal.common.CrashlyticsBackgroundWorker$3.then(CrashlyticsBackgroundWorker.java:105)
at com.google.android.gms.tasks.zze.run(com.google.android.gms:play-services-tasks@@18.0.2:1)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.google.firebase.crashlytics.internal.common.ExecutorUtils$1$1.onRun(ExecutorUtils.java:67)
at com.google.firebase.crashlytics.internal.common.BackgroundPriorityRunnable.run(BackgroundPriorityRunnable.java:27)
at java.lang.Thread.run(Thread.java:919)
..............
I faced the same problem. For some reason, only 20% of users have this problem regardless of the device (Huawei, Samsung, etc.) I plan to downgrade stripe to v32
Error:
Fatal Exception: java.lang.SecurityException Unknown calling package name 'com.google.android.gms'.
@BigPun86 @alex-vasylchenko same issue for me! If you disable Google Pay in initPaymentSheet, it works! @charliecruzan-stripe help!
Hm interesting, @BigPun86 you say this started this week- was this after an upgrade to your stripe-react-native version? @alex-vasylchenko you mentioned downgrading to v32- are you referring to the android SdkVersion?
This dependency is added by stripe-android, and we haven't changed anything about that dependency in quite a while.
I was not clear enough sorry.. I meant that i have heard from my customers this week that there were issues when they tried to pay. We had upgraded the @stripe/stripe-react-native from v0.30 to v0.33, that's where the crashes started. I have upgraded to v0.35 in order to try if this version maybe already has the fix. I guess downgrading to v0.30 will definitely fix the problem, might also work with v0.32 as @alex-vasylchenko mentioned, i will try this later on today and let you know
@BigPun86 @charliecruzan-stripe as I said in my previous message, if we disable Google Play, it works! I have the v0.31.1 and the app crashes too :(
Yes, i understand that @nicolasdevienne :) It is definitely related to google pay... but that is not an option, our customers mostly use google pay
Hm interesting, @BigPun86 you say this started this week- was this after an upgrade to your stripe-react-native version? @alex-vasylchenko you mentioned downgrading to v32- are you referring to the android SdkVersion?
This dependency is added by stripe-android, and we haven't changed anything about that dependency in quite a while.
I used to use "@stripe/stripe-react-native": "^0.32.0" and everything was fine, as soon as iI updated to "0.35.0".
I use only 3 stripe methods:
initStripe -> isPlatformPaySupported -> confirmPlatformPayPayment
And i get error after isPlatformPaySupported.
I have made a release with version 0.32.0, so far no errors
Yes, i understand that @nicolasdevienne :) It is definitely related to google pay... but that is not an option, our customers mostly use google pay
yes me too, it's just to make a test and try to target the issue :) it can help to find the solution...
Update: I'm not able to reproduce this on my Android 10 emulator so far in PaymentSheet. I am able to directly use Google Pay with the usePlatformPay hook methods, and when using those i do see the
java.lang.SecurityException: Unknown calling package name 'com.google.android.gms'.
message in logcat, so I'm wondering if that's a red herring. Are there any other messages in logcat from the crash for you all? It would be super useful to know that
UPDATE: confirmed this is a google issue: see https://issuetracker.google.com/issues/316040978?pli=1 and https://github.com/stripe/stripe-android/issues/7707
Update: I'm not able to reproduce this on my Android 10 emulator so far in PaymentSheet. I am able to directly use Google Pay with the
usePlatformPayhook methods, and when using those i do see thejava.lang.SecurityException: Unknown calling package name 'com.google.android.gms'.message in logcat, so I'm wondering if that's a red herring. Are there any other messages in logcat from the crash for you all? It would be super useful to know that
I can't reproduce this either, I already stressed that only 10-20% of users in my app have this problem and I don't understand why exactly
Update: I'm not able to reproduce this on my Android 10 emulator so far in PaymentSheet. I am able to directly use Google Pay with the
usePlatformPayhook methods, and when using those i do see thejava.lang.SecurityException: Unknown calling package name 'com.google.android.gms'.message in logcat, so I'm wondering if that's a red herring. Are there any other messages in logcat from the crash for you all? It would be super useful to know that
On simulator it's ok, it crashes on real device.
Hi All, I am facing same issue, app crashes when calling presentPaymentSheet for android v14. It works as long as I test it in emualtor. When I package it as an APK and run it on Android phone, it crashes on presentPaymentSheet page.
Any help would be appreciated.
This is my package.json configuration "scripts": { "start": "expo start", "android": "expo start --android", "ios": "expo start --ios", "web": "expo start --web" }, "dependencies": { "@expo/vector-icons": "^14.0.0", "@react-native-async-storage/async-storage": "^1.23.1", "@react-native-picker/picker": "2.7.5", "@react-navigation/native": "^6.1.17", "@react-navigation/native-stack": "^6.6.1", "@react-navigation/stack": "^6.3.29", "@stripe/stripe-react-native": "0.37.2", "@types/react": "~18.2.79", "babel-plugin-wildcard": "^7.0.0", "expo": "^51.0.9", "expo-build-properties": "~0.12.1", "expo-camera": "~15.0.10", "expo-constants": "~16.0.2", "expo-media-library": "~16.0.3", "expo-sqlite": "^11.6.0", "expo-modules-core": "~1.12.12", "expo-splash-screen": "^0.27.4", "expo-status-bar": "~1.12.1", "moment": "^2.29.4", "react": "18.2.0", "react-dom": "18.2.0", "react-native": "0.74.1", "react-native-country-codes-picker": "^2.3.4", "react-native-gesture-handler": "^2.16.2", "react-native-picker-select": "^9.0.0", "react-native-reanimated": "~3.10.1", "react-native-safe-area-context": "4.10.1", "react-native-screens": "^3.31.1", "react-native-tab-view": "^3.5.2", "react-native-web": "~0.19.6", "react-stripe-checkout": "^2.6.3" }, "devDependencies": { "@babel/core": "^7.24.0" },
I found solution for this issue. Before we call presentPaymentSheet, we need to initialize stripe. (initStripe). This was the missing piece. when I added initStripe logic, presentPaymentSheet is working fine as expected. Thank you.