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

SDK fails on Android 14 with targetSdkVersion to 34 #387

Closed
yogen-p opened this issue Oct 16, 2023 · 13 comments
Closed

SDK fails on Android 14 with targetSdkVersion to 34 #387

yogen-p opened this issue Oct 16, 2023 · 13 comments

Comments

@yogen-p
Copy link

yogen-p commented Oct 16, 2023

Summary

BT Reader discovery and Tap To Pay fail on devices running Android 14 with targetSdkVersion and compileSdk to 34.

Code to reproduce

Set targetSdkVersion to 34 and run on an Android 14 device in release mode.

The Example Kotlin can be used to reproduce Tap To Pay payment crash by:

  • Setting latestSdkVersion = 34 in the project build.gradle
  • Creating a release buildType with debuggable set to false.
  • Creating and providing a signingConfig for the release build.
  • Update DiscoveryViewModel to provide a LocalMobileDiscoveryConfiguration() object
  • Update ReaderClickListener to call Terminal.getInstance().connectLocalMobileReader(...)
  • Discover and connect to Tap To Pay
  • Try taking a payment using "Collect card payment" CTA

Android version

14

Impacted devices (Android devices or readers)

Devices that upgraded to Android 14

SDK version

I tested using 3.1.0, 2.23.2, and 2.22.0

Other information

Everything works fine in debug mode. The issues arise in release mode for me with minifyEnabled and shrinkResources set to true.
Discovering readers doesn't discover anything, and Tap To Pay crashes while trying to take a payment with the following exception:

FATAL EXCEPTION: DefaultDispatcher-worker-2
Process: com.stripe.cots.aidlservice, PID: 25264
java.lang.RuntimeException: java.lang.SecurityException: Writable dex file '/data/user/0/com.checkfer.lopaymerchant/cache/.    ' is not allowed.
	at java.lang.reflect.Constructor.newInstance0(Native Method)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
	at com.mastercard.terminalsdk.internal.n.<clinit>(Unknown Source:4285)
	at com.mastercard.terminalsdk.TerminalSdk.<init>(SourceFile:10)
	at com.mastercard.terminalsdk.TerminalSdk.getInstance(Unknown Source:9)
	at com.s.aa.Stripe$11661.<init>(:47)
	at com.s.ac.Connect$670.SDKs(:142)
	at com.s.ac.Connect$670.As(:36)
	at com.s.ac.Connect$670$3$8218.invokeSuspend(:64)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(SourceFile:12)
	at kotlinx.coroutines.DispatchedTask.run(SourceFile:124)
	at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(SourceFile:4)
	at kotlinx.coroutines.scheduling.TaskImpl.run(SourceFile:3)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(SourceFile:1)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(SourceFile:15)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(SourceFile:29)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(SourceFile:1)
	Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@e516463, Dispatchers.IO]
Caused by: java.lang.SecurityException: Writable dex file '/data/user/0/com.checkfer.lopaymerchant/cache/.    ' is not allowed.
	at dalvik.system.DexFile.openDexFileNative(Native Method)
	at dalvik.system.DexFile.openDexFile(DexFile.java:406)
	at dalvik.system.DexFile.<init>(DexFile.java:171)
	at dalvik.system.DexFile.loadDex(DexFile.java:231)
	at dalvik.system.DexFile.loadDex(DexFile.java:198)
	at com.mastercard.terminalsdk.internal.n.<clinit>(Unknown Source:2489)
	... 14 more



class=AidlRpcClient message="Failed to send request to AIDL service"
android.os.DeadObjectException
	at android.os.BinderProxy.transactNative(Native Method)
	at android.os.BinderProxy.transact(BinderProxy.java:584)
	at com.stripe.core.aidlrpc.AidlRpc$Stub$Proxy.makeRequest(AidlRpc.java:142)
	at com.stripe.core.aidlrpcclient.AidlRpcClient$makeRequest$1.invoke(AidlRpcClient.kt:84)
	at com.stripe.core.aidlrpcclient.AidlRpcClient$makeRequest$1.invoke(AidlRpcClient.kt:73)
	at com.stripe.core.aidlrpcclient.AidlRpcClient.withAidlService(AidlRpcClient.kt:106)
	at com.stripe.core.aidlrpcclient.AidlRpcClient.makeRequest(AidlRpcClient.kt:73)
	at com.stripe.stripeterminal.internal.common.adapter.CotsClient.makeRequest(CotsClient.kt:181)
	at com.stripe.stripeterminal.internal.common.adapter.CotsClient.collectPayment(CotsClient.kt:150)
	at com.stripe.stripeterminal.internal.common.adapter.CotsAdapter$collectPaymentMethodHandler$result$1.invokeSuspend(CotsAdapter.kt:147)
	at com.stripe.stripeterminal.internal.common.adapter.CotsAdapter$collectPaymentMethodHandler$result$1.invoke(Unknown Source:8)
	at com.stripe.stripeterminal.internal.common.adapter.CotsAdapter$collectPaymentMethodHandler$result$1.invoke(Unknown Source:4)
	at com.stripe.stripeterminal.internal.common.adapter.CotsAdapter$callAidlWithExceptionConverted$1$1.invokeSuspend(CotsAdapter.kt:360)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:280)
	at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
	at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
	at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source:1)
	at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
	at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source:1)
	at com.stripe.stripeterminal.internal.common.adapter.CotsAdapter.callAidlWithExceptionConverted(CotsAdapter.kt:360)
	at com.stripe.stripeterminal.internal.common.adapter.CotsAdapter.collectPaymentMethodHandler(CotsAdapter.kt:146)
	at com.stripe.stripeterminal.internal.common.adapter.CotsAdapter.collectPaymentMethod(CotsAdapter.kt:139)
	at com.stripe.stripeterminal.internal.common.adapter.ProxyAdapter.collectPaymentMethod(ProxyAdapter.kt:148)
	at com.stripe.stripeterminal.internal.common.terminalsession.TerminalSession$CollectPaymentMethodOperation.executeIfNotCanceled(TerminalSession.kt:1271)
	at com.stripe.stripeterminal.internal.common.terminalsession.TerminalSession$CancelableOperation.execute(TerminalSession.kt:1046)
	at com.stripe.stripeterminal.internal.common.terminalsession.TerminalSession$ExternalOperation.run$terminalsession_release(TerminalSession.kt:1004)
	at com.stripe.stripeterminal.internal.common.terminalsession.TerminalSession.enqueueOperation$lambda$6(TerminalSession.kt:863)
	at com.stripe.stripeterminal.internal.common.terminalsession.TerminalSession.$r8$lambda$6lM7341_XI6PEqXfOM-yc2U5tkQ(Unknown Source:0)
	at com.stripe.stripeterminal.internal.common.terminalsession.TerminalSession$$ExternalSyntheticLambda0.run(Unknown Source:4)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:487)
	at java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
	at java.lang.Thread.run(Thread.java:1012)


class=TerminalSession
com.stripe.stripeterminal.external.models.TerminalException: Contactless transaction failed com.stripe.core.aidlrpc.AidlRpcException: Failed to send request to AIDL server.
	at com.stripe.stripeterminal.internal.common.adapter.CotsAdapter.callAidlWithExceptionConverted(CotsAdapter.kt:371)
	at com.stripe.stripeterminal.internal.common.adapter.CotsAdapter.collectPaymentMethodHandler(CotsAdapter.kt:146)
	at com.stripe.stripeterminal.internal.common.adapter.CotsAdapter.collectPaymentMethod(CotsAdapter.kt:139)
	at com.stripe.stripeterminal.internal.common.adapter.ProxyAdapter.collectPaymentMethod(ProxyAdapter.kt:148)
	at com.stripe.stripeterminal.internal.common.terminalsession.TerminalSession$CollectPaymentMethodOperation.executeIfNotCanceled(TerminalSession.kt:1271)
	at com.stripe.stripeterminal.internal.common.terminalsession.TerminalSession$CancelableOperation.execute(TerminalSession.kt:1046)
	at com.stripe.stripeterminal.internal.common.terminalsession.TerminalSession$ExternalOperation.run$terminalsession_release(TerminalSession.kt:1004)
	at com.stripe.stripeterminal.internal.common.terminalsession.TerminalSession.enqueueOperation$lambda$6(TerminalSession.kt:863)
	at com.stripe.stripeterminal.internal.common.terminalsession.TerminalSession.$r8$lambda$6lM7341_XI6PEqXfOM-yc2U5tkQ(Unknown Source:0)
	at com.stripe.stripeterminal.internal.common.terminalsession.TerminalSession$$ExternalSyntheticLambda0.run(Unknown Source:4)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:487)
	at java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
	at java.lang.Thread.run(Thread.java:1012)
@yogen-p yogen-p changed the title SDK fails on Android 14 SDK fails on Android 14 with targetSdkVersion to 34 Oct 16, 2023
@ugochukwu-stripe
Copy link
Contributor

Hi @yogen-p, thanks for bringing this up, we're currently working on a fix for this, and will update here once the fix is out.

@bperez-stripe
Copy link

Hi @yogen-p, you can target sdk version 33 while we work on this fix. We are working diligently to get this resolved but the updates are not trivial and are not expected to be ready in the next few days. We will provide an update once we have a clear timeline for an SDK update that addresses this issue.

@yogen-p
Copy link
Author

yogen-p commented Oct 23, 2023

@bperez-stripe @ugochukwu-stripe Thanks for your response. For the being, that is exactly what I did and reverted back to version 33 and will keep using it until this is fixed. I understand this is going to be a major change, and will require some time. All is good now, since I reverted back to 33. Thanks

@chr-stripe
Copy link
Collaborator

We have released version 3.1.1 which contains a fix for discovering Bluetooth readers on Android 14 with targetSdkVersion 34. Fixes for USB and Tap To Pay readers will come in a subsequent release. I'll update this ticket as those are available in the coming releases.

@chr-stripe
Copy link
Collaborator

We have released version 3.2.0 which contains a fix for discovering USB readers on Android 14 with targetSdkVersion 34. A fix for Tap To Pay readers will come in a subsequent release. I'll update this ticket again when that becomes available.

@chr-stripe
Copy link
Collaborator

We have released version 3.2.1 which contains a fix for taking payments using Tap To Pay readers on Android 14 with targetSdkVersion 34. This version should now be fully compatible with using any kind of reader while targetting the latest API version.

@parthasarathi95

This comment was marked as off-topic.

@parthasarathi95
Copy link

now I am able to build the project.

@abhijitCN
Copy link

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:checkDebugDuplicateClasses'.

Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Failed to transform jackson-core-2.16.1.jar (com.fasterxml.jackson.core:jackson-core:2.16.1) to match attributes {artifactType=enumerated-runtime-classes, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.

I am using =>
{
buildToolsVersion = "34.0.0"
minSdkVersion = 26
compileSdkVersion = 34
targetSdkVersion = 34
ndkVersion = "25.1.8937393"
kotlinVersion = "1.8.0"
}
and
"dependencies": {
"@stripe/stripe-terminal-react-native": "^0.0.1-beta.16",
"react": "18.2.0",
"react-native": "0.73.6"
}
and gradle-8.3-all.zip for Android which version is wrong for me

@Zaynmiraj
Copy link

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:checkDebugDuplicateClasses'.

Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Failed to transform jackson-core-2.16.1.jar (com.fasterxml.jackson.core:jackson-core:2.16.1) to match attributes {artifactType=enumerated-runtime-classes, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.

I am using => { buildToolsVersion = "34.0.0" minSdkVersion = 26 compileSdkVersion = 34 targetSdkVersion = 34 ndkVersion = "25.1.8937393" kotlinVersion = "1.8.0" } and "dependencies": { "@stripe/stripe-terminal-react-native": "^0.0.1-beta.16", "react": "18.2.0", "react-native": "0.73.6" } and gradle-8.3-all.zip for Android which version is wrong for me

Also I had same problem

@chr-stripe
Copy link
Collaborator

Hi folks, this looks unrelated to the original issue reported here; I would recommend you file a separate issue so we can take a proper look. It also looks like you are using the React Native Terminal SDK so I'd recommend you file an issue in that repo instead: https://github.com/stripe/stripe-terminal-react-native

@davidvgalbraith
Copy link

davidvgalbraith commented Jul 24, 2024

Hi, in light of this issue's closure, is this line from the stripe-terminal-react-native README out of date?

Note that attempting to override minSdkVersion to decrease the minimum supported API level will not work due to internal runtime API level validation. Furthermore, Stripe is updating the Terminal Android SDK to support Google’s recently released Android 14 (SDK 34). Please continue to target SDK 33 in the meantime as there are known issues with mPOS devices and TTP when targeting SDK 34. Please track the following https://github.com/stripe/stripe-terminal-android/issues/387 for updates on progress.

@nazli-stripe
Copy link
Contributor

@davidvgalbraith yep the RN README is out of date, let me update

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

No branches or pull requests

9 participants