react-native-esc-pos-printer: Discovery on Android problem?

Hello. I get this error every time I try do discover printers on an android device.

ERROR Your app just crashed. See the error below. com.facebook.react.bridge.ObjectAlreadyConsumedException: Array already consumed com.facebook.react.bridge.WritableNativeArray.pushNativeMap(Native Method) com.facebook.react.bridge.WritableNativeArray.pushMap(WritableNativeArray.java:57) com.reactnativeescposprinter.EscPosPrinterDiscoveryModule$3$1.run(EscPosPrinterDiscoveryModule.java:258) android.os.Handler.handleCallback(Handler.java:942) android.os.Handler.dispatchMessage(Handler.java:99) android.os.Looper.loopOnce(Looper.java:226) android.os.Looper.loop(Looper.java:313) android.app.ActivityThread.main(ActivityThread.java:8775) java.lang.reflect.Method.invoke(Native Method) com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571) com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 17 (11 by maintainers)

Most upvoted comments

Thanks for the quick fix guys !

@tr3v3r it did ๐Ÿ˜„

Pleasure working with you @tr3v3r.

@edvijaka just released 4.1.3 based on your PR. I bet itโ€™ll work

Thanks for support

๐Ÿ˜„ will try your version now

๐Ÿคทโ€โ™‚๏ธ I tried, I canโ€™t get into the nitty gritty of android and java, unfortunately, but I do think the idea of cloning the array before sending it out would work, if anyone could implement it

One more try. Please check 4.1.2

I see also PR from @edvijaka. Looks good - will be the next candidate ๐Ÿ˜„

CC: @edvijaka

Just released a new version with the possible fix. Please check: 4.1.1

Unfortunately, I canโ€™t test it right now - so it is on you ๐Ÿ˜„.

Please update here regarding the results.

CC: @edvijaka @Jonyleeson

Hi @tr3v3r,

This bug seems to have been reintroduced.

Version used: 4.1.0 Printer: TM-M30II Problem: application crashes after discovering on android, after initially displaying the printer as detected in bluetooth (Iโ€™d guess once the same printer is detected again on LAN). Iโ€™m guessing the crash is related to discovering multiple printers, as if I disable bluetooth then there is no crash and the printer is detected on LAN.

Commit previously fixing bug: https://github.com/tr3v3r/react-native-esc-pos-printer/commit/e9276b804c9e221fc2dcf996c668902bf70d405d

Commit re-introducing bug: https://github.com/tr3v3r/react-native-esc-pos-printer/commit/b5275ae64ca87bc7c9fd3a16bff2f0a73a99ef7b

Yes the bug is fixed, thank you very much.