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

Crash on Release Build v4.0.0 && v.4.1.0 java.lang.NoSuchMethodError: No static method startTimedMetric #527

Open
jayjah opened this issue Nov 11, 2024 · 8 comments
Labels
Tap to Pay Issues with the Stripe Tap to Pay localmobile reader

Comments

@jayjah
Copy link

jayjah commented Nov 11, 2024

Summary

A crash is happening during a payment process only in release builds. This happens when TapToPay with v.4.0.0 is chosen.
Following stacktrace is visible:

                                                                                                    com.stripe.stripeterminal.external.models.TerminalException: Contactless transaction failed java.lang.IllegalStateException: App Error: SERVER_ERROR 'An unknown error has occurred: java.lang.NoSuchMethodError: No static method startTimedMetric$default(Lcom/stripe/loggingmodels/MetricLogger;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;ILjava/lang/Object;)Lcom/stripe/loggingmodels/Metric; in class Lcom/stripe/loggingmodels/MetricLogger; or its super classes (declaration of 'com.stripe.loggingmodels.MetricLogger' appears in /data/app/~~NKqak6cvB6gmZPkFmW_D1Q==/com.talex.mytaxidriver-q0DWEjoMpm8lAqPi0eu6Zw==/base.apk)'.
                                                                                                    	at com.stripe.stripeterminal.internal.common.adapter.CotsAdapter.callAidlWithExceptionConverted(CotsAdapter.kt:715)
                                                                                                    	at com.stripe.stripeterminal.internal.common.adapter.CotsAdapter.onReaderActivated(CotsAdapter.kt:467)
                                                                                                    	at com.stripe.stripeterminal.internal.common.adapter.ProxyAdapter.onReaderActivated(ProxyAdapter.kt:102)
                                                                                                    	at com.stripe.stripeterminal.internal.common.terminalsession.TerminalSession.activateReader$terminalsession_release(TerminalSession.kt:611)
                                                                                                    	at com.stripe.stripeterminal.internal.common.terminalsession.TerminalSession$ConnectReaderOperation.execute(TerminalSession.kt:2182)
                                                                                                    	at com.stripe.stripeterminal.internal.common.terminalsession.TerminalSession$ExternalOperation.run$terminalsession_release(TerminalSession.kt:1243)
                                                                                                    	at com.stripe.stripeterminal.internal.common.terminalsession.TerminalSession.enqueueOperation$lambda$6(TerminalSession.kt:1050)
                                                                                                    	at com.stripe.stripeterminal.internal.common.terminalsession.TerminalSession.$r8$lambda$9_FdDGpM1BaifeFRjKBBfCCLP6o(Unknown Source:0)
                                                                                                    	at com.stripe.stripeterminal.internal.common.terminalsession.TerminalSession$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)

Code to reproduce

Android version

Android 14

Impacted devices

Google Pixel 7a

Dependency Versions

    // stripe
    implementation "com.stripe:stripe-java:26.4.0"
    implementation "com.stripe:stripeterminal:4.0.0"
    implementation "com.stripe:stripeterminal-taptopay:4.0.0"
    implementation "com.stripe:stripeterminal-core:4.0.0"
@sidhant-stripe
Copy link
Contributor

sidhant-stripe commented Nov 11, 2024

Hi @jayjah

According to our documentation, you should replace implementation "com.stripe:stripeterminal:4.0.0" with

    implementation "com.stripe:stripeterminal-taptopay:4.0.0"
    implementation "com.stripe:stripeterminal-core:4.0.0"

Can you try removing the line implementation "com.stripe:stripeterminal:4.0.0" and let us know if this issue is still occurring?

Also, since this is only occurring in release builds, it seems like there might be a minification issue too. Can you provide any further details on your release build setup? Are you using proguard/dexguard?

If the above fix doesn't work, try adding the following to your proguard config:

-keep class com.stripe.** { *; }
-dontwarn com.stripe.**

@jayjah
Copy link
Author

jayjah commented Nov 12, 2024

Hi @sidhant-stripe, thank you for your response!

Unfortunately it's not possible for us to remove implementation "com.stripe:stripeterminal:4.0.0", because we use tap to pay and a bluetooth scanner from stripe within the same application.

Furthermore our proguard config already includes those lines.

Just for clarification:
This error does NOT happened with version 3.8.0 which was our last version where everything went fine.

@sidhant-stripe
Copy link
Contributor

hi @jayjah, I've checked internally and confirmed that you do not need to include the stripeterminal dependency if you're including stripeterminal-core. Will continue to investigate, but in the meantime can you remove that line and see if you're still getting the same error?

A serial number for the device, account ID and approximate date/time when you encountered this issue would also be helpful if you can provide them.

@jayjah
Copy link
Author

jayjah commented Nov 18, 2024

@sidhant-stripe Unfortunately the same error occurs when I remove stripeterminal as a dependency.

Sure, here are all information you asked for:

Device ID: 89033023427100000000027390897104
Monday, 18. November 08:35-08:37 (GMT+1)

I'll provide the account ID as soon as I got it from my co-worker.

@xiaoshen-stripe xiaoshen-stripe added the Tap to Pay Issues with the Stripe Tap to Pay localmobile reader label Nov 21, 2024
@jayjah
Copy link
Author

jayjah commented Dec 10, 2024

@sidhant-stripe Unfortunately the same error happened with version 4.1.0 and com.stripe:stripe-java:28.1.0.

Current stripe dependencies looks like the following:

    // stripe
    implementation "com.stripe:stripe-java:28.1.0"
    //implementation "com.stripe:stripeterminal:4.0.0"
    implementation "com.stripe:stripeterminal-taptopay:4.1.0"
    implementation "com.stripe:stripeterminal-core:4.1.0"

@jayjah jayjah changed the title Crash on Release Build v4.0.0 java.lang.NoSuchMethodError: No static method startTimedMetric Crash on Release Build v4.0.0 && v.4.1.0 java.lang.NoSuchMethodError: No static method startTimedMetric Dec 10, 2024
@RationalRank
Copy link

@sidhant-stripe I received the same error. My application's minimum SDK was 23. Updating it to 26 resolved the issue, and tap-to-pay now works as expected. Could you please help us understand if setting the minimum SDK to 26 is a mandatory requirement?

According to the documentation, the SDK relies on Java 8 methods and requires SDK 26.

Enabling desugaring while setting the minimum SDK to 23 throws a different error.

 Process: dev.ranjith.qa:stripetaptopay, PID: 4730
 java.lang.NoSuchMethodError: No static method getOrNull(Ljava/util/Optional;)Ljava/lang/Object; in class Lkotlin/jvm/optionals/OptionalsKt; or its super classes (declaration of 'kotlin.jvm.optionals.OptionalsKt' appears in /data/app/~~gedYiDtwJ7J60ouTvksvQQ==/dev.ranjith.qa-AOLfgmfdCnBpagxUrHGHcw==/base.apk!classes8.dex)
    at com.stripe.cots.pin.andQ31597.Connect(:75)
    at com.stripe.cots.pin.andQ31597.As(:32)
    at com.stripe.cots.pin.andQ31597.As(:1)
    at com.stripe.cots.pin.andQ31597.Build(:65354)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.stripe.cots.pin.skb.SecureKeyBoxWrapper.<init>(SourceFile:144)
    at com.s.af.builtN30636.As(:28)
    at com.s.af.builtN30636.Billing(:1)
    at com.s.af.builtN30636.Build(:65353)
    at com.s.af.buildingJ25130.Connect(:52)
    at com.s.af.buildingJ25130.Dashboard(:1)
    at com.s.af.buildingJ25130.Dashboard(:65353)
    at com.s.af.buildingJ25130.Dashboard(:41)
    at com.s.af.buildingJ25130.get(:13)
    at dagger.internal.DoubleCheck.getSynchronized(SourceFile:10)
    at dagger.internal.DoubleCheck.get(SourceFile:7)
    at com.s.af.canG6061.Billing(:52)
    at com.s.af.canG6061.get(:16)
    at dagger.internal.DoubleCheck.getSynchronized(SourceFile:10)
    at dagger.internal.DoubleCheck.get(SourceFile:7)
    at com.s.af.BillingS1543.Connect(:62)
    at com.s.af.BillingS1543.get(:17)
    at com.s.r.BillingN6887.Dashboard(:43)
    at com.s.r.BillingN6887.get(:14)
    at dagger.internal.DoubleCheck.getSynchronized(SourceFile:10)
    at dagger.internal.DoubleCheck.get(SourceFile:7)
    at com.s.r.BuildR23607.Connect(:38)
    at com.s.r.BuildR23607.get(:13)
    at dagger.internal.DoubleCheck.getSynchronized(SourceFile:10)
    at dagger.internal.DoubleCheck.get(SourceFile:7)
    at com.s.r.DashboardG30757.Connect(:43)
    at com.s.r.DashboardG30757.get(:14)
    at dagger.internal.DoubleCheck.getSynchronized(SourceFile:10)
    at dagger.internal.DoubleCheck.get(SourceFile:7)
    at com.s.u.evenO7538$BuildH11975.Build(:731)
    at com.stripe.cots.aidlservice.CotsService$AsG11088.invokeSuspend(:96)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(SourceFile:12)
    at kotlinx.coroutines.DispatchedTask.run(SourceFile:126)
    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:34)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(SourceFile:29)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(SourceFile:1)

Is stripe terminal SDK compatible with desugaring?

@chr-stripe
Copy link
Collaborator

Hi all,

The Terminal SDK is only compatible with apps supporting Android API level 26 and above. Note that the Terminal SDK will fail to initialize on devices less than API 26 due to internal runtime API level validation, so specifying a minSdk less than 26 is not supported.

On top of that, Tap to Pay integrations have an additional runtime requirement which requires that the device runs Android 11 (API level 30) or higher.

To my knowledge, the Terminal SDK doesn't necessarily need Java 8. It's just mentioned that it's compatible with Java 8 (and desugaring, if necessary) if your integration uses it.

@jayjah
Copy link
Author

jayjah commented Feb 26, 2025

Hi @chr-stripe

versions before 4.0.0 were fine to compile with Android API level below 26. We made runtime checks to make sure that the SDK will at first initialize only on valid API levels and run only on that specific valid API levels. Why was this behaviour changed with Version 4.0.0? This makes it currently absolute not usable at all for us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Tap to Pay Issues with the Stripe Tap to Pay localmobile reader
Projects
None yet
Development

No branches or pull requests

5 participants