BarcodeScanner crashes standalone but not on dev

SDK Version: 43
Platforms: ios/android

Hi. I’ve upgrade to expo 43 (from 41) and the barcode scanner (via expo-camera) simply does not scan any QR code (works fine expo client, works fine in —no-dev —minify), can’t test simulator as there is no camera …

But when I build (via EAS), it simply does not scan anything on iOS, whereas on Android, the moment it scans, it instantly crashes.

How do I debug this … ?

Does anyone have any clue how I can debug this?

  • scanner works fine in dev (expo go, as well as in production mode, --no-dev --minify)
  • scanner does not scan anything on iOS (in standalone build, at least it does not crash)
  • camera viewport is showing on Android, but when camera is initiated, it crashes.

I’ve managed to pull the error from Android Vitals (play console).
So, on Android, this is the error: TypeError: undefined is not an object (evaluating ‘P.default.BarCodeType’)

  • the same code works fine on Expo 41 (from where I’ve upgraded)
  • it also works fine via expo build:android

Just when building with EAS, it simply crashes, while on iOS, it does not crash, but it doesn’t scan anything either.

com.facebook.react.common.JavascriptException: TypeError: undefined is not an object (evaluating 'P.default.BarCodeType'), stack:
<unknown>@1009:1912
h@2:1585
<unknown>@1008:6484
h@2:1585
<unknown>@530:7963
h@2:1585
<unknown>@462:199
h@2:1585
<unknown>@6:60
h@2:1585
d@2:958
global code@1120:3
at com.facebook.react.modules.core.ExceptionsManagerModule.reportException(ExceptionsManagerModule.java
  at java.lang.reflect.Method.invoke (Native Method)
  at com.facebook.react.bridge.JavaMethodWrapper.invoke (JavaMethodWrapper.java:372)
  at com.facebook.react.bridge.JavaModuleWrapper.invoke (JavaModuleWrapper.java:151)
  at com.facebook.react.bridge.queue.NativeRunnable.run (Native Method)
  at android.os.Handler.handleCallback (Handler.java:938)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage (MessageQueueThreadHandler.java:27)
  at android.os.Looper.loop (Looper.java:246)
  at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run (MessageQueueThreadImpl.java:226)
  at java.lang.Thread.run (Thread.java:923)

I’ve figured it out. Solution is to include expo-barcode-scanner in your package.json.

I think we should do one of the following:

  1. Have EAS account for this automatically, since BarcodeScanner is a dependency
  2. Add a note to the API Reference so that others know they need to install it if they want barcode scan support if the above is not possible