Android application crash after updating to latest square reader sdk on new installs

On a new install of our application we are now getting the following crash after the user clicks “Allow” on all the required permissions:

Scope com.squareup.container.WorkflowScope was destroyed – this crash does not happen when users upgrade from the previous version of our application.

Here is the full stack trace.

java.lang.IllegalStateException: Scope com.squareup.container.WorkflowScope was destroyed
at shadow.mortar.MortarScope.assertNotDead(MortarScope.java:264)
at shadow.mortar.MortarScope.findService(MortarScope.java:131)
at shadow.mortar.MortarScope.getService(MortarScope.java:116)
at com.squareup.container.inversion.FlowRunnerKt.getFlow(FlowRunner.kt:76)
at com.squareup.ui.main.GatekeepersRootWorkflow$render$1$1.invokeSuspend(GatekeepersRootWorkflow.kt:99)
at com.squareup.ui.main.GatekeepersRootWorkflow$render$1$1.invoke(Unknown Source:8)
at com.squareup.ui.main.GatekeepersRootWorkflow$render$1$1.invoke(Unknown Source:4)
at com.squareup.workflow1.InterceptedRenderContext$runningSideEffect$withScopeReceiver$1.invokeSuspend(WorkflowInterceptor.kt:306)
at com.squareup.workflow1.InterceptedRenderContext$runningSideEffect$withScopeReceiver$1.invoke(Unknown Source:8)
at com.squareup.workflow1.InterceptedRenderContext$runningSideEffect$withScopeReceiver$1.invoke(Unknown Source:2)
at com.squareup.workflow1.InterceptedRenderContext$runningSideEffect$1$1.invokeSuspend(WorkflowInterceptor.kt:311)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.EventLoop.processUnconfinedEvent(EventLoop.common.kt:69)
at kotlinx.coroutines.DispatchedTaskKt.resumeUnconfined(DispatchedTask.kt:244)
at kotlinx.coroutines.DispatchedTaskKt.dispatch(DispatchedTask.kt:161)
at kotlinx.coroutines.CancellableContinuationImpl.dispatchResume(CancellableContinuationImpl.kt:397)
at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl(CancellableContinuationImpl.kt:431)
at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl$default(CancellableContinuationImpl.kt:420)
at kotlinx.coroutines.CancellableContinuationImpl.resumeWith(CancellableContinuationImpl.kt:328)
at kotlinx.coroutines.flow.SharedFlowImpl.tryEmit(SharedFlow.kt:368)
at com.squareup.gatekeeper.Gatekeeping.updateGatekeepers(Gatekeeping.kt:31)
at com.squareup.ui.main.Historian.nextHistoryToShowWhileResetting(Historian.kt:343)
at com.squareup.ui.main.Historian.resetHistory(Historian.kt:239)
at com.squareup.ui.main.WorkflowPosContainer.resetHistory(WorkflowPosContainer.kt:184)
at com.squareup.ui.systempermissions.EnableDeviceSettingsPresenter.updatePermissionsState(EnableDeviceSettingsPresenter.java:137)
at com.squareup.ui.systempermissions.EnableDeviceSettingsPresenter.onResume(EnableDeviceSettingsPresenter.java:82)
at com.squareup.pauses.PauseAndResumePresenter.activityResumed(PauseAndResumePresenter.java:72)
at com.squareup.ui.main.MainActivity.onResume(MainActivity.java:218)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1476)
at android.app.Activity.performResume(Activity.java:8441)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:5200)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:5269)
at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:54)
at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2438)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8663)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)

:wave: What’s your application ID and the location ID this happened with? :slightly_smiling_face:

Application ID is – sq0idp-6rgRny31WOjf4_7ggH9XKg , not sure what you mean by location ID?

Your customer has to log into a specific location to process payment. The location_id will look something like 3Z4V4WHQK64X9. :slightly_smiling_face:

Bryan -

This is in our custom Android application, we are using the Square Reader SDK our customers are not logging into a location.

Does that make sense?

MTW

The mobile authorization requires a location_id from your customer. Do you know what that location_id is? :slightly_smiling_face:

Bryan -

I am not using mobile authorization as you mentioned, I am using the Square Reader SDK – https://developer.squareup.com/docs/reader-sdk/build-on-android – and there is no mention of location ID, nor I have used one in the past as we have been using this SDK for years. It just started NOT working when updating to the latest version.

Thanks - MTW

Bryan -

Do you have any more thoughts on this issue we are having?

Thanks - MTW

We are getting this also with Android 12 devices on ReaderSDK 1.5.5 and we tried the upgrade to 1.5.6 and that had same issues and crashed more on Android 12 devices.

We found it was during the initial setup on a clean device with no pairing established. The settings screen seems to work better unpairing and pairing later… but during the first install the ReaderSDK setup crashes.