stripe-android: Android card scan sheet crashes on some devices[BUG]
Summary
Some devices crash when cardScanSheet.present is called
Code to reproduce
val cardScanSheet = activity?.let {
CardScanSheet.create(
from = this,
stripePublishableKey = "KEY...",
{ cardScanSheetResult: CardScanSheetResult ->
when (cardScanSheetResult) {
is CardScanSheetResult.Completed -> {
if (activity is AddNewCardActivity)
(activity as AddNewCardActivity).setCardNumber(
cardScanSheetResult.scannedCard.pan
)
}
is CardScanSheetResult.Canceled -> {
if (activity is AddNewCardActivity)
(activity as AddNewCardActivity).setCardNumber("")
}
is CardScanSheetResult.Failed -> {
if (activity is AddNewCardActivity)
(activity as AddNewCardActivity).setCardNumber("")
Log.e("failed", cardScanSheetResult.error.message)
}
else -> {
try {
Log.e("failed", cardScanSheetResult.toString())
} catch (e: Exception) {
e.printStackTrace()
}
}
}
}
)
}
cardScanSheet?.present()
Android versions: 9, 10, 12
Impacted devices: OPPO Reno 10x room, Samsung galaxy s9 and Samsung Galaxy Note 10
Installation method
implementation 'com.stripe:stripe-android:20.10.0' implementation 'com.stripe:stripecardscan:20.10.0'
Dependency Versions
kotlin: 1.6.21 stripe-android: 20.10.0 Android Gradle Plugin: 7.2.2 Gradle: 7.5.1
SDK classes
Stack
com.stripe.android.camera.framework.util.LayoutKt.intersectionWith (Layout.kt:280) com.stripe.android.camera.framework.image.ImageKt.determineViewFinderCrop (Image.kt:58) com.stripe.android.camera.framework.image.ImageKt.cropCameraPreviewToViewFinder (Image.kt:85) com.stripe.android.stripecardscan.payment.ml.SSDOcr$Companion.cameraPreviewToInput (SSDOcr.kt:123) com.stripe.android.stripecardscan.cardscan.CardScanFlow$startFlow$1$invokeSuspend$lambda-2$lambda-1$$inlined$map$1$2.emit (Emitters.kt:224) kotlinx.coroutines.flow.FlowKt__ChannelsKt.emitAllImpl$FlowKt__ChannelsKt (Channels.kt:62) kotlinx.coroutines.flow.FlowKt__ChannelsKt.access$emitAllImpl$FlowKt__ChannelsKt (Channels.kt:1) kotlinx.coroutines.flow.FlowKt__ChannelsKt$emitAllImpl$1.invokeSuspend (Unknown Source:14) kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:33) kotlinx.coroutines.DispatchedTask.run (DispatchedTask.kt:106) kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely (CoroutineScheduler.kt:570) kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask (CoroutineScheduler.kt:750) kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker (CoroutineScheduler.kt:677) kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run (CoroutineScheduler.kt:664)
Operating System Version:Android 10 Orientation: Portrait Rooted:No
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 18
This was released with version 20.15.2
hey @dingwilson , we’re anticipating a release tomorrow.
Hey @dingwilson apologies for the delay. I’ve included a fix PR which should solve the issue here.
that’s quite helpful. thank you!