Mobile Payments SDK 2.6.1 (Android): main thread blocked ~7s causing ANRs and Tap to Pay being unavailable

The Mobile Payments SDK’s reader startup is blocking our Android app’s main thread for about 7 seconds. It’s our most common ANR in Google
Play Console, which puts us well above Play’s 0.47% bad-behaviour threshold. We believe the same issue is why Tap to Pay on Android never
becomes available in our app.

Environment

  • Mobile Payments SDK for Android 2.6.1, through mobile-payments-sdk-react-native 2026.8.1
  • Production environment
  • Seen in production on many devices (Mali-GPU devices and Pixels, several Android versions), and reproduced on a Pixel 7a running Android
    17

Main-thread stack (every sample in the cluster)
"main" Timed Waiting
at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:276)
at com.squareup.cryptoattestation.compatibilitycheck.RealKeyProvisionCompatibilityChecker.getReport(RealKeyProvisionCompatibilityChecker.
kt:225)
at com.squareup.cryptoattestation.compatibilitycheck.RealKeyProvisionCompatibilityChecker.meetsRequirement(RealKeyProvisionCompatibilityC
hecker.kt:240)
at com.squareup.posencryption.RealHieroglyphKeyProviderRequirementChecker.getMeetsRequirement(RealHieroglyphKeyProviderRequirementChecker
.kt:21)
at com.squareup.cardreaders.RealEcrAvailable.isAvailable(RealEcrAvailable.kt:27)
at com.squareup.cardreaders.RealCardreaders.connectAllReaders(RealCardreaders.kt:342)
at com.squareup.cardreaders.RealCardreaders.continueInitAfterLibraryLoading(RealCardreaders.kt:173)
at com.squareup.cardreaders.RealCardreaders.onLibrariesLoaded(RealCardreaders.kt:498)
at com.squareup.cardreader.loader.RelinkerLibraryLoader.onSuccess$lambda$0(RelinkerLibraryLoader.kt:52)
at android.os.Looper.loop(...)

What we’ve observed

  1. After authorize() succeeds, or straight after MobilePaymentsSdk.initialize() when an authorization is already saved,
    RelinkerLibraryLoader posts onLibrariesLoaded to the main looper. RealEcrAvailable.isAvailable() then calls getReport(), which waits on
    reportLatch for up to key-provision-compatibility-get-report-timeout-ms. The blocks we measured were consistently 6.8–7.5 s.
  2. In every production ANR trace we’ve looked at, no thread is running keystore or cryptoattestation work while the main thread waits. The
    executor threads (e.g. pool-12-thread-1) are idle. It looks as if the work getReport() waits for hasn’t been scheduled, or is queued
    behind the blocked main thread, so the wait only ends at the timeout.
  3. When we called initialize() but delayed authorize() by about 45 seconds, the main thread didn’t block at all. Initializing in
    Application.onCreate() doesn’t help returning users, though: with a saved authorization, readers start immediately, and our app’s first
    frame went from ~2 s to ~11 s.
  4. If the report times out, meetsRequirement() would be false. That matches what we see for Tap to Pay: tapToPaySettings.isDeviceCapable()
    returns false, and no TAP_TO_PAY reader ever appears in readerManager.readers. Square Point of Sale offers Tap to Pay on the same phone
    and account.
  5. This looks like the same code path as an earlier unresolved report on Reader SDK 1.7.5:
    Reader ANR on generateKey

Questions

  1. Can getReport() and meetsRequirement() be kept off the main thread, or can connectAllReaders run off the main looper?
  2. Can prepareReport() end up waiting on the main thread, or not have started before getReport() is called?
  3. Can cardreaders-use-cached-compatibility-report be enabled for an application, and can the get-report timeout be checked per
    application? We can share our application ID privately.
  4. Is there an SDK newer than 2.6.1 that changes this?

In the meantime, we’re working around it by starting the SDK only when a payment actually needs it, which keeps the freeze off app launch.
We’d appreciate any guidance, and we can share full ANR traces or logcat captures.

I sent you a DM for some identifiers to troubleshoot this.

I’ve replied and attached the requested files. Thank you for looking into this

Just letting you know I’m still looking into this, working with internal teams to get some guidance for you.

The issue that was causing this was that we had Gradle files that had exclude group: 'org.bouncycastle' rules. Removing this solved the issue. Thank you Zac!