sdk-android icon indicating copy to clipboard operation
sdk-android copied to clipboard

com.zettle.sdk.feature.cardreader.payment.IllegalTransitionException crash

Open KucherenkoIhor opened this issue 10 months ago • 6 comments

steps to reproduce:

  1. Charge
  2. Disconnect the reader
  3. Discovery has started
  4. Turn on the reader -> hold Power Button a bit longer

crash:

01-16 20:51:01.578  1787  2316 E AndroidRuntime: com.zettle.sdk.feature.cardreader.payment.IllegalTransitionException: Invalid action UpdateReaderState [Disconnected] in state o5
01-16 20:51:01.578  1787  2316 E AndroidRuntime: 	at com.zettle.sdk.feature.cardreader.payment.TransactionImpl$action$1$1.invoke(r8-map-id-b4862a2a904381bc373fe2511cfc1bf9d172ebfa03bebfb2deb89a12c6a69ed0:129)
01-16 20:51:01.578  1787  2316 E AndroidRuntime: 	at com.zettle.sdk.feature.cardreader.payment.TransactionImpl$action$1$1.invoke(r8-map-id-b4862a2a904381bc373fe2511cfc1bf9d172ebfa03bebfb2deb89a12c6a69ed0:1)
01-16 20:51:01.578  1787  2316 E AndroidRuntime: 	at tk1.c.d(r8-map-id-b4862a2a904381bc373fe2511cfc1bf9d172ebfa03bebfb2deb89a12c6a69ed0:8)
01-16 20:51:01.578  1787  2316 E AndroidRuntime: 	at com.zettle.sdk.feature.cardreader.payment.TransactionImpl$action$1.invoke(r8-map-id-b4862a2a904381bc373fe2511cfc1bf9d172ebfa03bebfb2deb89a12c6a69ed0:4)
01-16 20:51:01.578  1787  2316 E AndroidRuntime: 	at com.zettle.sdk.feature.cardreader.payment.TransactionImpl$action$1.invoke(r8-map-id-b4862a2a904381bc373fe2511cfc1bf9d172ebfa03bebfb2deb89a12c6a69ed0:1)
01-16 20:51:01.578  1787  2316 E AndroidRuntime: 	at com.zettle.sdk.commons.thread.EventsLoopImpl$post$1.invoke$lambda$0(r8-map-id-b4862a2a904381bc373fe2511cfc1bf9d172ebfa03bebfb2deb89a12c6a69ed0:1)
01-16 20:51:01.578  1787  2316 E AndroidRuntime: 	at androidx.compose.foundation.text.contextmenu.internal.c.run(r8-map-id-b4862a2a904381bc373fe2511cfc1bf9d172ebfa03bebfb2deb89a12c6a69ed0:12)
01-16 20:51:01.578  1787  2316 E AndroidRuntime: 	at android.os.Handler.handleCallback(Handler.java:938)
01-16 20:51:01.578  1787  2316 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:99)
01-16 20:51:01.578  1787  2316 E AndroidRuntime: 	at android.os.Looper.loopOnce(Looper.java:201)
01-16 20:51:01.578  1787  2316 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:288)
01-16 20:51:01.578  1787  2316 E AndroidRuntime: 	at android.os.HandlerThread.run(HandlerThread.java:67)

KucherenkoIhor avatar Jan 21 '26 07:01 KucherenkoIhor

IllegalTransitionException inherits AssertionError and could not be handled with a catch block. IllegalTransitionException <- AssertionError <- Error

Could you please also change the parent class to the Exception class? Because internal issue in the external SDK leads to crash the whole application.

denyszwix avatar Jan 21 '26 07:01 denyszwix

Hi @KucherenkoIhor and @denyszwix ,

Thank you for bringing this issue to our attention. We haven't been able to reproduce this issue previously, nor by following the steps you shared. We will nevertheless explore potential fixes, including handling this state transition more gracefully to prevent app crashes even in unexpected scenarios.

To help us reproduce and resolve this issue more effectively, could you please provide some additional information?

  1. When you say "charge" do you mean that you have just started a payment via the SDK or was it already showing on the reader?
  2. What steps did you follow to disconnect the reader?
  3. What connection method are you using - USB or Bluetooth?
  4. The stack trace appears to contain obfuscated state names (e.g., "state o5"). Do you happen to have a log that has that part non-obfuscated?
  5. Is this crash consistently reproducible following the exact steps you outlined, or does it occur intermittently?

Thank you for your assistance!

nataliq-pp avatar Jan 23 '26 16:01 nataliq-pp

@KucherenkoIhor, @denyszwix, could you please check my colleague's message and help to answer the questions? Also, could you please share what SDK version do you use?

CheZhongSdk avatar Jan 27 '26 11:01 CheZhongSdk

  1. Just started via SDK
  2. Power off
  3. BT
  4. com.zettle.sdk.feature.cardreader.payment.IllegalTransitionException: Invalid action UpdateReaderState [Disconnecting] in state NoReaderAvailable
  5. it is very hard to reproduce

KucherenkoIhor avatar Mar 05 '26 09:03 KucherenkoIhor

@CheZhongSdk @nataliq-pp 🔝

KucherenkoIhor avatar Mar 05 '26 09:03 KucherenkoIhor

@KucherenkoIhor The issue you reported above should be fixed in this SDK release. Please check it out and let us know if you still have any issue. Thanks!

CheZhongSdk avatar Mar 06 '26 10:03 CheZhongSdk